ID:140064
 
Code:
        spawn()
proc/act()
for()
if(health<=0) break


Problem description:

SO I was wondering, because I'm trying to make AI for while the zombie is still alive, what exactly does that error mean because I want to get this fixed.
The blue "proc" and "verb" keywords are used for declaring new procs and verbs. You can't declare a new proc in the middle of another one.

You however can call an existing proc by writing its name with parentheses in the end.

Note that if you have a simple breaking condition, you shouldn't set up an infinite loop and use break. Use the condition part of the loop constructs (for()'s 2nd arg and while()'s only arg).
In response to Kaioken
Thanks, I appreciate that, but what I'm trying to do is make it so that the NPC acts while it still alives as if it were a zombie, so how can I do that?
In response to CodeWeasel22
mob/NPC/Zombine
New()
act()

proc/act()
spawn() //don't hold up the caller (New())
while(src.health > 0) //if the zombie is deleted once dead, then you don't need a condition here
viewers(src) << "[src] is a zombie"
sleep(10) //wait a second

//if the loop ends, then it means zombine's dead.


If you still don't understand why this code would compile and yours didn't, then you have to read the guide.
In response to Kaioken
Thank you sir, I have been reading the guide just not following it while coding, just been using what I've learned and remember.
In response to Kaioken
Well actually, how can I make a loop that works as the mob is still alive, but it doesn't necessarily have to call a proc?
In response to CodeWeasel22
CodeWeasel22 wrote:
Well actually, how can I make a loop that works as the mob is still alive, but it doesn't necessarily have to call a proc?

A loop that doesn't necessarily call a proc would be a (potentially) empty loop, which will effectively lock up your game.

Presumably you mean something else, but I really can't imagine what.
In response to Garthor
Alright then, how can I make AI that does things every second or so?
In response to CodeWeasel22
In response to Kaioken
That doesn't work...