I have this code in my room script:
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...
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...
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.
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...
As with any other numbers, you can define constants to be able to distinguish them easier:
#define TIMER_FOR_SOME_ACTION 2
<...>
SetTimer(TIMER_FOR_SOME_ACTION, 100);