MOO-cows Mailing List Archive

[Prev][Next][Index][Thread]

Re: Couple of Questions



> I have a verb that looks roughly like this....
> 
> @verb #15711:call_regen()
> 
> rooms = children(#15711);
> timer = 20;
> while (timer > 0)
    fork (0)
  >   for x in (rooms)
  >     x:regen();
  >     x:action();
  >   endfor
    endfork
>   suspend(60);
>   timer = timer + 1;
[This should be -1 or it will count up forever?]
> endwhile
> 
> 
> It does what I want it to with regen() (which is call the verb regen() and
> action() in every room that is a child of #15711 every minute for 20
> minutes) But for action() it doesn't.  action() is very similar to the above
> verb in that is has the same while statements to cause a timer affect.  So,
> if action() takes a while and uses suspend() also, it messes up the timing
> of call_regen().  Any way to prevent this?

By putting fork/endfork around your calls you create a new task for them 
that isn't affected by the previous task suspending or reading.

TTFN
Andy


References:

Home | Subject Index | Thread Index