The "timer" Function
#
SyntaxArgument | Type | Description |
---|---|---|
id | string | Sets a unique timer ID, as a string |
[duration] | real | Optional: Sets the duration of time to countdown, in seconds (use none to create timer only) |
#
DescriptionSets and/or counts down a timer and returns false
until the time has expired, after which it will return true
. (To return the actual time value, see timer_get
.)
The timer ID should be a unique string value. Timers and their IDs are local to the running instance, so multiple timers can use the same ID in different instances. However, the same ID cannot be reused within a single instance. Otherwise, there is no limit on the quantity of timers that can exist at once.
Timer duration is measured in seconds. This value is automatically adapted to framerate and delta time.
tip
See the included interactive demo for a visual example of this function!