MOO-cows Mailing List Archive

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

Re: LPMOO HELP, please.



At 11:42 AM 8/29/95, Tosh wrote:
>Ok, can someone 'splain this?
>
>;for x in [1..100000] if (ticks_left() < 5000) suspend(10); else
>notify(player, tostr(ticks_left())); endif endfor
>
>This will spam me until x = 100000 and it won't suspend, tho' the ticks
>are reset.  the output looks like this:
>.
>.
>.
>5035
>5004
>29954
>29346
>.
>.
>.
>and so one until it loops back again.
>Now if I do this next thing I get a totally different result:
>
>;for x in [1..100000] if (x == 15000) suspend(10); else
>notify(player, tostr(ticks_left())); endif endfor
>
>The output is:
>spam
>spam
>spam
>.
>.
>.
>6032
>5889
>And here it suspends, allowing calls to @forked and allowing other tasks
>to run.
>Then it runs out of ticks.
>So the problem seems to be suspend() and ticks_left() working together,
>but what is going on here?
>Tosh
> --
>| |##|## ||||| #|#|# |#|## ||||# #||#| ||#|# #|||| #|#|# #|||| ##|| |##|
>This ^^^^ is my government barcode identifier. # = thick lines, | = thin
>I don't make this stuff up.                     cooey@server.uwindsor.ca

>From doc/differences:

- Task execution limits are in DGD terms; no attempt is made to simulate
   tick or seconds counting. {ticks,seconds}_left() are approximate.

ticks_left() is often very inaccurate, which is probably why you're getting
the problems you're getting, and also is why
$command_utils:suspend_if_needed() doesn't work very well with LPMOO.

Matt Pauker





Home | Subject Index | Thread Index