Timer not functioning (using CW module) SOLVED

Started by Mr Games, Tue 27/11/2018 21:58:00

Previous topic - Next topic

Mr Games

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
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?

Crimson Wizard

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.

Mr Games

Another mystery solved! Thank you, now I understand how it works.

SMF spam blocked by CleanTalk