Here it comes
Code: Select all
TIMERS
{
0 [0]
1 [0]
2 [0]
3 [0]
}
SetTimer[ (timer, time)
{
TIMERS[timer]=self.time+StringCopy(time);
} ]
CheckTimer[ (timer)
{
if(TIMERS[timer]=0)
{
return false;
}
if(self.time>TIMERS[timer])
{
TIMERS[timer]=0;
return true;
}
return false;
} ]
Code: Select all
SetTimer(0,2);
and then when you want to check if the 2 seconds passed, you do:
Code: Select all
if(CheckTimer(0))
{
//Do something
}
Note that you have to reset all timers when you switch between low and high level (one of the reasons you should not switch too often, use low level whenever possible). The timers only work in low level.
Have fun!
EDIT: Added timer reset.