mob/proc/Action()
if(var/mob/M isnot in oview()) // note i added an isnot so if M is not in oview, don't call anything
return
else //else if M is in oview()
// do procs here
sleep(10)
Action() //calls again after 1 second.
ID:171381
Oct 3 2004, 6:14 am
|
|
I don't know if this is the right forums but I've always wondered how to break a loop like this. I've added some extra stuff like isnot which is not part of the DM language.
|
Oct 3 2004, 6:32 am
|
|
ZDarkGoku wrote:
|
In response to Hanns
|
|
Hanns wrote:
> This one should work. No this won't work. You have an else without any if statment preceding it. And I don't look for a debug. I made the <font color=blue>isnot</font> tag on my own as to show like "If there is no mob/M in the oview(), then do some proc, and if there is a mob/M in oview(), do some other proc". |
ZDarkGoku wrote:
> mob/proc/Action() Have you tried doing something like this? mob/proc/Action() [edit] Just changed that one line as pointed out. [/edit] |
In response to Lazyboy
|
|
Lazyboy wrote:
if(!locate(/mob) in oview(src)) Problem: The in operator has a much much lower precedence than most, so the ! takes priority. To make this do what you really want, you need to put parentheses around it and put the ! outside. if(!(locate(/mob) in oview(src))) Many a developer has stubbed a toe on that one. Lummox JR |