ID:174662
 
well, heres my problem. i have a proc which loops...
proc
counter(counter_stop)
if(num==0)
world<<"sorry, the answer was [answer]"
else
if(counter_stop==0)
num-=1
world<<"[num]"
spawn(10) call(/proc/counter)()
...and i can't stop it from counting down until it reaches zero, not even if i have another proc like this...
proc
turn_off_counter()
counter_stop=1
...plz help me, why doesn't this last proc stop the first proc? someone help...
Probleme is, counter_stop is a parameter, not a variable, that means it is only to specifie how the procedure will work, and it is set when you launch the procedure, that means other code cant change it after it started, what you need is a gobal variable counter_stop.

proc
counter(counter_stop)
if(num==0)
world<<"sorry, the answer was [answer]"
else
if(counter_stop==0)
num-=1
world<<"[num]"
spawn(10) call(/proc/counter)()

turn_off_counter()
counter_stop=1

Change to:
add gobal variable var/counter_stop=0

counter()
if(num==0)
world<<"sorry, the answer was [answer]"
num-=1
world<<"[num]"
spawn(10)
if(!counter_stop)counter()

turn_off_counter()
counter_stop=1
I would suggest something like this:
mob/proc/counter(counter_stop)
while(counter_stop==0)
num-=1
world<<"[num]"
spawn(10) counter()
return

In response to FranquiBoy
i tried your code out, but it just kept decreasing. should you have put a else cause in that?
In response to FranquiBoy
counter()
if(num==0)
world<<"sorry, the answer was [answer]"
else
num-=1
world<<"[num]"
spawn(10)
if(!counter_stop) counter()

turn_off_counter()
counter_stop=1


Your right, I do need an else, try it now