Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Mr Games on Tue 27/11/2018 21:58:00

Title: Timer not functioning (using CW module) SOLVED
Post by: Mr Games on Tue 27/11/2018 21:58:00
Hi guys :grin:

I initially couldn't get the timer to work and found a thread where another user had the same issue.
Here I discovered Crimson Wizard's Timer Module and imported the script. But my timer still isn't working.

Code (ags) Select
Timer *chickenTimer;

function room_AfterFadeIn()
{
  chickenTimer = Timer.StartRT(5.0);
  if (Timer.IsExpired(chickenTimer)) {
  cSmileyface.ChangeRoom(15);
  }
}


I want to change room when the timer expires, but as far as I can tell there's nothing wrong with my code. Am I missing something?
Title: Re: Timer not functioning (using CS module)
Post by: Crimson Wizard on Tue 27/11/2018 22:19:09
You need to check for timer expiration in "repeatedly execute" event.

What happens in your code here is this: you create a timer, immediately check it for expiration once (which won't happen since it just started) and leave it.
Title: Re: Timer not functioning (using CW module)
Post by: Mr Games on Tue 27/11/2018 22:29:07
Another mystery solved! Thank you, now I understand how it works.