ID:261891
 
my code here doesn't like me for some reason...
It gives me the following error:
Timer.dm:6:error: expected expression

here is my code it reads as followed

verb/Count()
set catagory = "Commands"
if (icon = '321counter.dmi' in oview, icon = '321counter.dmi', icon_state = "go")

turf
321_Counter
icon = '321counter.dmi'

the name of the code file is Timer.dm but i can't seem to figure out whats wrong .

what it does is highlights the

321_counter

in the turf section

also if possible i need a way to stop the icon_state = "go"
after it runs through once and is avaliable to other users who click the "count" command.

thanks -Moolittle
scratch that acually, i fixed it and a new set or errors occured :

Carworld.dm:46:error:catagory:undefined var
Carworld.dm:47:error:icon:undefined var
Carworld.dm:47:error:oview:undefined var
Carworld.dm:47:error:icon:undefined var
Carworld.dm:47:error:icon_state:undefined var
Carworld.dm:47:error::invalid expression


ahehehe help?
In response to Chibi_Gohan123
scratch that again hehe i fixed it and it gave me the errors

Timer.dm:3:error:oview:undefined var
Timer.dm:3:error::invalid expression

my revised code reads as:

mob/verb/Count()
set category = "Commands"
if (icon = '321counter.dmi' in oview, icon = '321counter.dmi', icon_state = "go")

it highlights the bottem line of code (line 3) for both errors

... thanks if possible
-Moolittle
In response to Chibi_Gohan123
Chibi_Gohan123 wrote:
mob/verb/Count()
set category = "Commands"
if (icon = '321counter.dmi' in oview, icon = '321counter.dmi', icon_state = "go")

There are a few problems here... firstly, that's not how to check for multiple conditions in an if() statement. It makes sense to us, but not to the computer. Instead of separating things with commas, you want to separate them with the "and" operator, "&&" (without the quotes obviously). Secondly, the equals sign (=) just by itself is the assignment operator; in English, it basically says "make the thing on the left equal the thing on the right". You want the equality operator, which is two equal signs; "==". It basically says "is the thing on the left equal to the thing on the right?". Thirdly, oview is a proc, not a var; so you need to use parentheses, like this: oview().
In response to Crispy
...acually crispy, i thought i had fixed it, I was SO happy, but, it didn't work of course, an error which haunts me left and right...

THE ERROR EXPRESION THINGY

Timer.dm:3:error::invalid expression


... i know something i did was really dumb and stupid, my code reads as followed, im sorry if i have been a pest but im a really newb to coding...

mob/verb/Count()
set category = "Commands"
if (icon == '321counter.dmi' in oview(), icon == '321counter.dmi' && icon_state == "go")

it highlights line 3 (the last one)
In response to Chibi_Gohan123
Go read my response to your other post: [link]

You just proved me right on every point. You're changing things at random to "fix" things, but you don't know what's broken and you don't know why your "fix" would work, if it did, which it didn't.

Quick hint: If you "fix" something and you just get different errors, you didn't fix anything, you just found a new way to break it.

icon == '321counter.dmi' in oview()

What the heck are you trying to do here?

What are you trying to accomplish? An icon can't be in oview()! A mob or obj or turf or area (also known as atoms) can be in oview(), and those things can all have icons, but the icon itself sure can't be.

And then you have:

, icon == '321counter.dmi' && icon_state == "go")

I'm not even going to guess what the heck you're trying to do here.

I couldn't begin to tell you how to fix it since your code is so garbled it's impossible to tell what you want it to do or even what you think it should do... so here's the best advice I can give you under the circumstances:

Actually learn how to code. None of this try stuff at random. Oh, I know, "But that's how I learn!" Well, no, it isn't... that's how you can avoid learning and still sometimes manage to seem to accomplish something.

If you want to try to explain, in plain and detailed English, what you're trying to accomplish, I'll show you how to do it... I'll lay down the coding techniques exactly... but I expect you to actually read the explanation much more closely then you read the code. The code is garbage. The code is transitory and can be written by anyone. It's the explanation that will keep you from coming back here the next time you try something new.
In response to Hedgemistress
Thanks Headress, I've read your post. Ok now i will explain what i am trying accomplish. Firstly the icon==321counter in oveiw() if supposed to be if that icon, 321 counter, is in your sight, you can have the choice of pressing "count"

Then, when you press count, it should make it run thorugh the icon_state "go"

If possible i was wondering how to make a user "not go" before the timer has run down.

Also I would like the icon_state to stop after it has gone once.

I'm sorry about my complaint, it's just i can't find any demos that mactch my complaint, nor do i understand some of the errors that occur to me

-Thanks
-Moolittle
In response to Chibi_Gohan123
Okay. You've got two concepts way wrong.

One, like I said, an icon CANNOT be in your sight. Those things on the screen aren't icons. They're objects, aka ATOMS, aka areas, turfs, objs, and mobs. Do not think of them as icons. Icons are properties of atoms. Atoms have icons, but atoms are not icons.

Two, an if() statement determines if a chunk or line of code executes... not if the verb is available to the player. Using ifs() to determine if a verb is accessible doesn't work... it just makes it so the verb does nothing sometimes. You could put in else at the end and give a failure message, but that's kind of bass-ackwards. This is what "set src" is for. You make the verb belong to the obj or mob that you need in order to use the verb, and then set src accordingly.

If you don't already have one, you'll need to make an obj/321counter and set its icon.


obj
321counter //make a type of object.
icon = '321counter.dmi' //give it this icon
verb/count() //give it this verb
set src in oview() //can be used by players in sight of it.
flick(src,"go") //run src (this counter) through icon state "go" once.
usr.nogo = 1 //set the usr's nogo var to 1
src.verbs -= /obj/321counter/verb/count //remove this option for now.
sleep(3) //assuming there's 3 frames in the counter.
src.verbs += /obj/321counter/verb/count //give the verb back.

if (usr) usr.nogo = 0 //make sure usr is still there... usr could've logged out or died in the past 3/10ths of a second.


Of course, you need to make mobs have a nogo var:

mob
var
nogo = 0

And so far, all we've done with "nogo" is make it up and have the computer switch it back and forth when you use the timer. That by itself doesn't do anything except switch a var back and forth.

client
Move() //when the built-in movement is called by a player...
if (mob.nogo) //if nogo is on...
return 0 //then stop right here.
else //but if not
return ..() //then do the "usual thing"
In response to Hedgemistress
I think i acually get what your saying and i acually understood it a bit!

But of course it didn't work

The reader thought that src.verbs += /obj/321counter/verb/Count , it thought that the 321counter part was expected to be the end of the statment

BUT IT ISN'T!

Count is the end of the statment

Why does it do that?

Timer.dm:14:error: counter: expected end of statement
Timer.dm:16:error: counter: expected end of statement

UT O! ^-^

-Moolittle
In response to Chibi_Gohan123
Because Count is not supposed to have a capital C, possibly. Capitalization counts when making games in BYOND.
In response to Jon88
Jon your not being very specific
In response to Chibi_Gohan123
Your line reads "src.verbs += /obj/321counter/verb/Count" correct? Yet your verb is not Count(), but count(). Maybe if you change Count to count on those lines the compiler won't give you an error anymore.
In response to Chibi_Gohan123
Look very closely at those lines of code. You've probably got something in the verb's path that doesn't belong there... a space, the wrong slash, extra punctuation, etc.
In response to Hedgemistress
Actually, using the exact code you provided I ended up with pretty much the same problem.
Apparently DM doesn't like atoms that start with a number. Calling 123counter a123counter, and changing all the references of it to the same, caused the errors to disappear.
In response to Jon88
Ah, good point... I had completely forgotten that.

Yes, path nodes cannot start with numbers. If you want an object to actually be named "321 Timer", you could make

obj
timer
name = "321 Timer"
In response to Hedgemistress
sorry headress, i was on vacation for a week or so

back to busyness ^-^

ok i get what you are saying, but it gets me so frustrated and confused when it messes up and i don't what's wrong because the errors make no sense at all and when i try to fix them my self it make a bazillion errors to add to it here is my code and here are the errors that occur sorry if i have been a pest really!

obj
timer
name = "timer"

obj
counter //make a type of object.
icon = 'timer.dmi' //give it this icon
verb/count() //give it this verb
set src in oview() //can be used by players in sight of it.
flick(src,"go") //run src (this counter) through icon state "go" once.
usr.nogo = 1 //set the usr's nogo var to 1
src.verbs -= /obj/timer/verb/count //remove this option for now.
sleep(10) //assuming there's 3 frames in the counter.
src.verbs += /obj/timer/verb/count //give the verb back.

if (usr) usr.nogo = 0 //make sure usr is still there... usr could've logged out or died in the past 3/10ths of a second.


//Of course, you need to make mobs have a nogo var:

mob
var
nogo = 0

//And so far, all we've done with "nogo" is make it up and have the computer switch it back and forth when you use the timer. That by itself doesn't do anything except switch a var back and forth.

client
Move() //when the built-in movement is called by a player...
if (mob.nogo) //if nogo is on...
return 0 //then stop right here.
else //but if not
return ..() //then do the "usual thing"


Timer.dm:18:error:/obj/timer/verb/count:undefined type path
Timer.dm:20:error:/obj/timer/verb/count:undefined type path
In response to Chibi_Gohan123
Remember, you called it obj/counter.