Skip to content

Timer

The Timer library implements timers, for running scripting with a delay. Since listeners for the timers ending can be registered in-line, they are usually cleaner to use than the Osiris timers. Additionally, they are available on the client.

TimerLib Class

Inherits from Feature.

Events and Hooks

TimerCompleted (event)

@field Timer TimerLib_Entry

Methods

GetTimer
function TimerLib.GetTimer(stringID)
   -> TimerLib_Entry

Returns the timer with the passed string ID.

@param stringID string

Remove
function TimerLib.Remove(timer)

@param timer TimerLib_Entry

Start
function TimerLib.Start(id, seconds, handler, timerType)
   -> TimerLib_Entry|TimerLib_TickTimerEntry

@param id string?

@param seconds number

@param handler fun(ev:TimerLib_Event_TimerCompleted)

@param timerType ("Normal"|"Tick")? Defaults to `"Normal"`

StartTickTimer
function TimerLib.StartTickTimer(id, ticks, handler)
   -> TimerLib_TickTimerEntry

@param id string?

@param ticks number

@param handler fun(ev:TimerLib_Event_TimerCompleted)