Script cue API
A script cue runs JavaScript on its own worker thread when the cue fires, and holds the show until it finishes.
How it runs
awaitworks; the cue is not finished until the script is.- A script that outlasts its timeout is stopped and reported as a failure. The default is 60000 ms;
0waits for ever. - STOP, panic, and a stop cue aimed at this one all end it.
- An empty script does nothing and completes at once.
- A script cannot reach the interface. It has the helpers below and nothing else.
console.log()andconsole.error()write to the run log. One run is capped at 200 lines before it is truncated.
Trust
A workspace file is executable code and network-triggerable: a script cue runs a
system command as you when it fires, and a network trigger (OSC, MIDI or show
control) lets one packet on the show network fire any cue, scripts included. Only
open .cuerunner files you trust, and only on a network you trust — the
composition is the risk, not either half alone. OSC input listens on all interfaces
by default.
shell(command, options?)
Runs a system command and resolves with its result.
const r = await shell('echo dimmer 80%')
console.log(r.stdout.trim())| Resolves | Options |
|---|---|
{ stdout, stderr, code, signal } |
timeout (ms, default 10000), cwd, env |
Commands start in the workspace's folder.
include('path/to/file.js')
Runs another JavaScript file and resolves with whatever that file returned, so a helper file can hand back values. Each file runs once per cue however many times it is included, and an include inside a file resolves relative to that file.
const rig = await include('lib/rig.js')
await rig.blackout()Where the output goes
The run log. In a packaged build there is no developer console, so the
Log tab is the only place to read what a script printed. Running
from source, the same lines also appear in the terminal as
[renderer] ….