← Manual

Macros and variables

Recording command sequences, replaying them, and prompting for values.

A macro is a recorded list of commands you can replay by name. Anything you can type, you can record; anything you can record, you can put on a key or a MIDI pad.


Recording

STORE MACRO "houselights"      # start recording (RECORD MACRO reads better)
CONFIG BLACKOUT EXCLUDE 90 THRU 96
GO 90
STORE STOP                     # stop recording

Everything you run between the two lines goes into the macro - including commands you ran by clicking, because GUI actions go through the same command path.


Running and managing

MACRO                          # list all macros
MACRO LIST
MACRO SHOW houselights         # print its commands
PLAY MACRO houselights
PLAY MACRO houselights LOG     # …printing each command as it runs
MACRO DELETE houselights
EDIT MACRO houselights         # open it in the editor

LOG is what you want the first time a macro misbehaves: it shows you exactly which line did the damage.


Sharing macros

EXPORT MACRO houselights houselights.json
IMPORT MACRO houselights.json
IMPORT MACRO houselights.json venue_houselights   # import under a new name

Macros are plain JSON, so they travel between machines and shows independently of the showfile.


Variables

Variables make a macro reusable rather than a fixed script. They last for the session and are not saved with the show.

$intensity = 75
$label = opening state         # multi-word values are quoted for you
FIXTURE 1 THRU 4 INTENSITY $intensity
STORE CUE 1 $label
SHOW VARS

Arithmetic uses +, -, *, /:

$n = 10
$n = $n + 5                    # 15
$n = $n * 2                    # 30

Names start with a letter and are case-insensitive. Non-numeric arithmetic and division by zero are reported rather than silently swallowed.


Asking the operator

INPUT $cue "Which cue? "
PRINT Storing cue $cue
STORE CUE $cue

INPUT prompts and stores what is typed; PRINT writes to the command history. Together they turn a macro into a small tool rather than a fixed sequence.


A worked macro

RECORD MACRO "buildcolour"
INPUT $g "Which group? "
INPUT $c "Colour palette id? "
GROUP $g
PALETTE $c
INTENSITY 100
PRINT Group $g set to palette $c
STORE STOP

PLAY MACRO buildcolour

Putting a macro on a key or a pad

MAP KEY CTRL M COMMAND "PLAY MACRO buildcolour" ENTER
MAP MIDI "APC mini" 1 NOTE 12 TO COMMAND "PLAY MACRO houselights"

See MIDI and keyboard mapping.


See also

The command line · MIDI and keyboard mapping

Related topics