Wait

Syntax

Command Description Return Value
Wait <time> Causes the execution of the current script to be suspended for a given number of seconds An id number to identify the pending commands
Wait Clear Causes all commands that are currently waiting to be cancelled The number of cancelled waits
Wait Stop <id> Causes the pending commands with the given id to be cancelled The number of cancelled waits
Wait ? Returns the number of currently waiting commands A number
  • <time>
    • A decimal number of seconds (optionally using decimal digits for fractions of seconds).
  • <id>
    • A decimal number internally assigned to the pending commands. Use this number with the Wait Stop command.

Abbreviations

W, WCL, WSTO, W?

Description

The Wait command causes the current command line to be suspended for a given number of seconds. Use Wait to cause a delay between script steps.

The Wait Clear command cancels all currently waiting commands. If more than one command is currently in a waiting state, all of them will be cleared simultaneously.

The Wait Stop command cancels only the commands with the given id.


Using the Wait Stop command

To use the Wait Stop command, the id of the pending commands must be stored in a variable.

For instance, if the following command is executed on the command line:

Button 1 On; Wait 5; Button 2 On

Button 1 will turn on immediately, then 5 seconds later Button 2 will turn on. A more detailed look at what is happening reveals that the first Button command executes immediately, then the Wait command executes. When CueScript encounters a Wait command, the remainder of the command line is placed in a queue and assigned an id. Then, CueScript stops processing commands, returning the id of the pending commands.

To cancel the queued commands, the Wait Stop command can be used. The Wait Stop command requires the id of the queued commands to stop. In order to save this special id for use with the Wait Stop command, the id can be placed in a variable. See the following example:

"myID" = (Button 1 On; Wait 5; Button 2 On)

The commands from the first example are placed in parenthesis. The parenthesis cause the enclosed commands to execute as a single expression. The result of that expression is stored in the variable myID.

If after a short delay (for example, 3 seconds later) it is desired to cancel the execution of the “Button 2 On” command that is in the queue to be executed, the following command can be executed:

Wait Stop 'myID'

Examples

Channel 1 At FL; Wait 5; At 0
Sets Channel 1 to FL, then waits 5 seconds, then sets Channel 1 to 0.

Cue 1 Go; Wait 2.5; Clear
Executes Cue 1, then waits 2.5 seconds, then clears the playback fader.

Wait Clear
Clears all currently waiting commands.

"stopCue" = (Playback 1 Clear; Wait 10; Cue 1 Go)
Clears Playback 1, then waits 10 seconds, then executes Cue 1. Also, the id of the pending “Cue 1 Go” is placed in the variable “stopCue”.

Wait Stop 'stopCue'
Stops the pending “Cue 1 Go” from the previous example. Will return “1” if the command was stopped. Will return “0” if the command was not found in the queue.