Notch Notch Manual 0.9.23
 Light | Dark


Purpose #

Creates a timer that calls a function at the interval specified.

Syntax #

void Timer(float interval, func function, string name, bool repeat);


functionThe function that should be called when timer reaches interval
intervalThe time interval in seconds between calls
nameA string name you can refer to the timer with, mainly to be able to use CancelTimer(). [Optional]
repeatWhen 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()
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.