The timer functions allow timing of events in milliseconds. The timer is a started with the timer_reset
command which takes an integer variable.
To find the amount of time that the timer has been running for use the tr_elapsed function. The first argument is a variable to return the elapsed time in and the second argument is the timer to get.
There are two functions for checking if a timer has expired the timer_isexpired and tr_regular. They both take the same 3 arguments the first is an evl_bool which gets set to true if the timer has expired, the second is the timer argument and the final argument is the timeout of the timer.
The timer_isexpired function just indicates when the timeout has expired, the tr_regular function indicates that the time out has expired and then resets the timer.
The following shows an example of the timer in action.
//---------------------------------------
// File: Timer.e
//---------------------------------------
//---------------------------------------
// Block: go
//---------------------------------------
block Go
Expired = false
//Start two timers
tr_reset Timer1
tr_reset Timer2
//Check if timed out
while Expired == false
//check if the loop timer has expired
tr_isexpired Expired Timer1 5000
//check if the print timer has expired
tr_regular Expired2 Timer2 250
//if timer2 has expired then print message
if Expired2 == true
//print the expired time
tr_elapsed ExpiredTime Timer1
outl ExpiredTime
_if
_while
outl "Finished"
_block