Skip to main content

The "timer_set_time" Function

Syntax#

timer_set_time(id, duration, [instance]);
ArgumentTypeDescription
idstringThe unique timer ID to modify, as a string (or keyword all for all local timers)
durationrealSets the duration of time to countdown, in seconds
[instance]instanceOptional: Sets the object instance containing the timer to modify (use none for self)

Description#

Overrides the current time in the specified timer, restarting the countdown process. If the timer does not exist, it will be created, but not countdown.

Note that if this script is run in an event that is executed every frame (e.g. Step), the timer will be unable to countdown! If this is required, use an if statement to only set the timer under certain conditions.

tip

See the included interactive demo for a visual example of this function!

Example#

timer_set_time("t_alarm", 5);
timer_set_time("t_other", 5, my_other_inst);