Accessing trigger variables, Writing messages to the controller's status log, Storing data on the memory card – ETC Unison Mosaic Designer v1.11.0 User Manual
Page 212

Unison Mosaic Designer User Manual
Accessing the current state of BPS buttons and setting BPS LEDs
get_bps(number)
Returns as an object the BPS by number.
bps:get_state(button)
State of the button (1 to 8) of the returned BPS object, values are
RELEASED, PRESSED, HELD or REPEAT.
bps:set_LED(button, effect, intensity,
fade)
Sets the button (1 to 8) of the returned BPS object, effect can be OFF,
STATIC, SLOW_FLASH, FAST_FLASH, DOUBLE_FLASH, BLINK,
PULSE, SINGLE, RAMP_ON or RAMP_OFF. Intensity is optional and
should be between 0 and 255, if not specified, the LED intensity is left
unchanged from its current value. If intensity is specified, fade can also
optionally be specified and should be between 0s and 25.4s.
For example:
myBPS = get_bps(1)
if (myBPS:get_state(2) == HELD) then
mpBPS:set_LED(2, FAST_FLASH, 255, 0.5)
end
Accessing trigger variables
The variable must have been captured by the trigger running the script.
variable[index]
Value of variable with given index
Writing messages to the Controller's status log
log(“string”)
Writes string into the log
Storing data on the memory card
Using a Lua script it is possible to store data as a file on the memory card. Unlike variables in memory, data
stored to a file will not be affected by resetting the Controller or cycling the power. The file can be read back at
any time to access the data. This can be very useful in show control situations where some system status inform-
ation needs to be stored persistently even if the Controller is reset. Alternatively it can allow you to store large
data tables on the memory card and only read the data when it is needed.
To work with files on the memory card use the standard I/O library functions described in the Lua documentation.
When writing to a file always close the file explicitly to make sure your data is correctly stored. The full file path to
a file on the memory card differs per Controller, so we have provided a function to create the full file path for you:
get_resource_path("my_file")
Returns the full file path for the given file name.
For example:
file = io.open(get_resource_path("myfile"), "r")
if (file ~= nil) then
local line = file:read()
- 212 -