Timer doesn't work with timer ID 1?

Started by tor.brandt, Wed 16/11/2016 16:59:41

Previous topic - Next topic

tor.brandt

I have this code in my room script:
Code: ags
function room_FirstLoad()
{
  SetTimer(2, 100);
}

function room_RepExec()
{
  if (IsTimerExpired(2))
  {
    cSoundEffects.SayBackground("RIIING RIIING");
  }
}


If I change "2" to "1" (i.e. if I use timer ID 1 instead of ID 2, it doesn't work.
What could be the cause of this?

PS. I'm using a couple of modules I didn't write myself, but I've searched through them and they have no instances of "timer", so I take it they are not occupying timer 1 for some other purpose...

Slasher

QuoteI'm using a couple of modules I didn't write myself, but I've searched through them and they have no instances of "timer", so I take it they are not occupying timer 1 for some other purpose...
The Floating Hotspot module uses Timer 1 so there could be one tucked away somewhere...

Cassiebsg

To make sure, you can right click above the "SetTimer" and select "Find all usages of SetTimer".
That should show you how many there are in your project.

Wish I could name the timers instead of using numbers though.
There are those who believe that life here began out there...

tor.brandt

Thanks for the replies!

I'll check those things when I get home.
And yeah, it would be nice if the timers could be inherently named, although I guess it would be fairly easy to name the timers in some custom way...

Crimson Wizard

As with any other numbers, you can define constants to be able to distinguish them easier:
Code: ags

#define TIMER_FOR_SOME_ACTION 2

<...>

SetTimer(TIMER_FOR_SOME_ACTION, 100);

SMF spam blocked by CleanTalk