Skip to content

Timers and turnscripts

DisableTimer (timer)

Disables the specified timer, by setting its enabled attribute to false. See EnableTimer to turn it back on.

DisableTurnScript (turn script)

Disables the specified turnscript, by setting its enabled attribute to false. See EnableTurnScript to turn it back on.

EnableTimer (timer)

Enables the specified timer. Note that this sets the trigger attribute as well as setting enabled to true.

EnableTurnScript (turn script)

Enables the specified turnscript, by setting its enabled attribute to true. See DisableTurnScript to turn it off again.

GetTimer (string timer name)

hard-coded

Returns the timer of the specified name. Returns null if the timer doesn’t exist.

Pause (interval)

Pauses for the given number of seconds, then carries on with the rest of the script.

Note: Quest 5.5 stopped supporting this, because pausing tied up a real thread. Quest Viva suspends the script instead, so it works again in games marked as ASL version 600. It still raises an error in a game whose version is 550 to 580; change the game’s version to 600 or later to use it, or use SetTimeout.

SetTimeout (interval, script)

or

SetTimeout (interval){ script }

Runs the specified script after the specified time interval.

If you may need to cancel the timer after creation, you can create a named timer using SetTimeoutID.

Note: This function is “non-blocking”, and its script has no access to local variables. For a fuller discussion, see Saving while a question is waiting.

SetTimeoutID (integer interval, string name, script)

or

SetTimeoutID (integer interval, string name){ script }

Runs the specified script after the specified time interval.

The name specifies the name of the timer to create. The anonymous version of this function is SetTimeout.

Note: This function is “non-blocking”, and its script has no access to local variables. For a fuller discussion, see Saving while a question is waiting.

SetTimerInterval (timer, interval)

Sets the specified timer’s interval, in seconds, between each time it fires - equivalent to setting its interval attribute directly.

SetTimerScript (timer, script)

or

SetTimerScript (timer){ script }

Sets the specified timer script.

SetTurnScript (turn script, script)

or

SetTurnScript (turn script){ script }

Sets the script for the specified turn script.

SetTurnTimeout (turn count, script)

or

SetTurnTimeout (turn count){ script }

Runs the specified script after the specified number of turns.

If you may need to cancel the turnscript after creation, you can create a named turnscript using SetTurnTimeoutID.

Note: This function is “non-blocking”, and its script has no access to local variables. For a fuller discussion, see Saving while a question is waiting.

SetTurnTimeoutID (integer turn count, string name, script)

or

SetTurnTimeoutID (integer turn count, string name){ script }

Runs the specified script after the specified number of turns.

The name specifies the name of the turnscript to create. The anonymous version of this function is SetTurnTimeout.

Note: This function is “non-blocking”, and its script has no access to local variables. For a fuller discussion, see Saving while a question is waiting.

SuppressTurnscripts ()

Stops all turnscripts running for one turn.

For more on turnscripts, see here.