Time-Outs? How?

Started by Haddas, Fri 12/12/2003 18:34:18

Previous topic - Next topic

Haddas

How do I make time-outs (or whatever they're called)?

For instance, I press the self-destruction button and a puzzle needs to be solved in... say 60 seconds or the ship blows up? Can it be made to work through several rooms?

Scorpiorus

#1
Ags Timer should work fine:

starts timer number 2 ticking for 100 game loops:
SetTimer (2, 100);


check whether timer 2 has expired:
if (IsTimerExpired (2)==1) {

Display("time out. BOOM!!!");
}


To disable ticking (puzzle is solved):
SetTimer (2, 0);



If you want it to tick 60 seconds:
SetTimer (2, 60*GetGameSpeed());


QuoteCan it be made to work through several rooms?
Yes, just place the if (IsTimerExpired (2)==1) checking in the repeatedly_execute() function of the global script.

~Cheers





SMF spam blocked by CleanTalk