Timer()
Purpose #
Creates a timer that calls a function at the interval specified.
Syntax #
void Timer(float interval, func function, string name, bool repeat);
Parameters
function | The function that should be called when timer reaches interval |
interval | The time interval in seconds between calls |
name | A string name you can refer to the timer with, mainly to be able to use CancelTimer(). [Optional] |
repeat | When true (default), the timer will repeat, when false, the time will be a one shot. [Optional] |
Example #
function Init()
{
Timer(1.0, myTimerFunction, name='secondTimer', true);
}
function myTimerFunction()
{
Log("ping");
}
Use View->Log Window to see the log file.
You cannot call Timer in the global scope. Easiest to initiate from code initiated by either Init or Update.