  | |  | Question About Timeout Objects | Question About Timeout Objects 2003-12-17 - By Pranav Negandhi
Back >From personal experience, I'd say timeouts are great. Especially for the kind of work that you deploy them for. I've had some problems with using persistent variable references with timeout objects.
1) using them as properties or globals makes the timeout reference remain alive and 2) the timeout remains active, even after calling forgot() on the variable.
e.g. gTimeoutObject = timeout("waitForaWhile").new(yada yada...) ....
on killTimer gTimeoutObject.forget() put gTimeoutObject
-- timeout("waitForaWhile")
The same thing happens with property variables too. The odd thing is that the timeout would get deleted from the timeoutList. The only way to kill it then is to explicitly void the variable
gTimeoutObject = VOID
Solution? I use the timeout NAME as the reference. Like so -
gTimeoutName = "waitForaWhile" vTmp = timeout(gTimeoutName).new(....
on killTimer timeout(gTimeoutName).forget() end
I dont have _any_ references at all to timeout objects in my code. Been working like a charm since the past three years or so. All this used to happen on my office machine - WinNT, D8. I don't know how DMX functions with timeouts.
Pranav Negandhi concept-I www.cimultimedia.com
Does your operat~1 system unders~1 long filena~1?
<snip> > QUESTION: Based on recent discussion threads related to timeout objects, > should each timeout object be assigned its own variable when > instantiated, and if so should the timeout object variables be global? > > The code below has been working without any problems for my game, but I > want to make sure I'm not using timeout objects in a "dangerous" way. > > -- WAIT, THEN START THE NEXT ROUND > on waitForNextRound me > gNextRoundTimeout = timeOut("NewRound").new(2000, #startNextRound) > end > > -- WAIT, THEN GO TO THE END OF GAME SCREEN > on waitForEndGameScreen me > gEndOfGameTimeout = timeOut("EndOfGame").new(3000, > #handleGameOverScreen) > end > > on startNextRound > timeOut("NewRound").forget() -- reset the new round timer > timeOut("WaitMoveHand").forget() -- reset the move computer hand timer > end > <snip>
__ ____ ____ ____ ____ ____ ____ ____ ____ ____ dirGames-L mailing list - dirGames-L@(protected) http://nuttybar.drama.uga.edu/mailman/listinfo/dirgames-l
Earn $52 per hosting referral at Lunarpages.
|
|
 |