Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Haddas on Fri 12/12/2003 18:34:18

Title: Time-Outs? How?
Post by: Haddas on Fri 12/12/2003 18:34:18
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?
Title: Re:Time-Outs? How?
Post by: Scorpiorus on Fri 12/12/2003 18:49:32
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