Jibble

Author Topic: AGS: How Do I Make A Hidden Timer in AGS?  (Read 435 times)

Will

  • That's It... mmKay?
    • I can help with proof reading
    • I can help with translating
AGS: How Do I Make A Hidden Timer in AGS?
« on: 22 Oct 2018, 14:37 »
Hello Guys,

Could you tell me how do I make a Hidden Countdown Timer to A Game in AGS? I would like to know. Thank you! :)
will :)

Matti

Re: AGS: How Do I Make A Hidden Timer in AGS?
« Reply #1 on: 22 Oct 2018, 15:26 »
I'm not sure what you mean by hidden timer, but if you look up SetTimer in the manual I think you will find what you need.

Re: AGS: How Do I Make A Hidden Timer in AGS?
« Reply #2 on: 23 Oct 2018, 08:04 »
Yeah, all timers are "hidden" unless you specifically script something to happen while the timer's running.

Assuming you just want to set a timer and have it count down to a game event, then

Code: Adventure Game Studio
  1. SetTimer(1, 80);

will set Timer No. 1 to 80 game loops, i.e. 2 seconds. You want to set this at the point in the script where you want the timer to start counting down.

Then, in RepEx, you control what happens when the timer reaches 0. This is so that the game is checking every loop to see if there's any time left.

Code: Adventure Game Studio
  1. if (IsTimerExpired(1)) //This continually checks whether or not Timer No. 1 has expired and returns the below if it has.
  2.   {
  3.     //Whatever you want to happen
  4.   }
« Last Edit: 23 Oct 2018, 14:02 by Lewis »
Returning to AGS after a hiatus. Co-director of Richard & Alice and The Charnel House Trilogy.

Will

  • That's It... mmKay?
    • I can help with proof reading
    • I can help with translating
Re: AGS: How Do I Make A Hidden Timer in AGS?
« Reply #3 on: 23 Oct 2018, 17:38 »
Thanks but...

How do I know if I set by Let's just say 7 Seconds... What should be it's int timeout integer of it?
will :)

Khris

  • partook in silencing a crtitc despite facts
    • Lifetime Achievement Award Winner
    • I can help with play testing
    • I can help with scripting
    • I can help with translating
    • Khris worked on one or more games that was nominated for an AGS Award!
Re: AGS: How Do I Make A Hidden Timer in AGS?
« Reply #4 on: 23 Oct 2018, 17:43 »
Use this:
Code: [Select]
  SetTimer(1, GetGameSpeed() * 7);
That way the timer will expire after 7 seconds regardless of the frames per second setting (which is 40 by default, so you pass 280 or 40 * 7).
« Last Edit: 23 Oct 2018, 17:45 by Khris »
Fail at Floaty Rog' now!  still having to deal with what games are going through