Purpose

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

Syntax

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

  • interval: The time interval in seconds between calls
  • function : The function that should be called when timer reaches interval
  • 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");
}