Lua API (Triggering). Acclaim Lighting PHAROS VLC, PHAROS LPC X, PHAROS TPS, PHAROS EXT, PHAROS TPC, PHAROS LPC
Anúncio
Anúncio
Lua API (Triggering)
Lua API (Triggering)
We use a scripting language called Lua, which has been extended to provide functionality specific to the Pharos
Controllers. Tutorials and reference manuals for the Lua language can be found at www.lua.org
. We will not attempt to document the Lua language here, but just the Pharos specific extensions. Please contact
if you need assistance with preparing a script or if you would like some examples as a starting point.
Lua Script Editor
The Lua Script Editor allows you to edit scripts from Triggers, Conditions and Actions within Designer. The Script
Editor is launched by pressing the Script Editor button on the Trigger Toolbar:
The main area of the editor is the code editor where you enter the source code of the script. The code editor will colour the Lua syntax to aid readability. Standard clipboard shortcuts and undo/redo are supported.
To create a new script for use in Conditions or Actions click New Script.
Scripts can be opened using the Open option and closed with the
To import a Lua script from an external file, use Import.
To save a Lua script to a file, use Export.
on the Script Tab.
To compile the script and check for syntax errors, use Build. If there are errors in the script, they will be displayed at the bottom of the window.
Changes to scripts are saved automatically.
Pharos Extensions For Trigger Scripts
Syntax
Where a function returns an Object (e.g. get_timeline(num)) additional functions and variables become available. To access a function, add a colon (:) between the functions: get_timeline(1):start() – This will get the timeline object for timeline 1 and apply the start function to it (starting timeline 1)
To access a variable, add a period (.) between the function and the variable: get_timeline(1).is_running – This will return a boolean value indicating
- 595 -
Pharos Designer User Manual whether timeline 1 is running
Variants
A variant is a user object within the Lua Scripting environment which includes information about what type of information is stored.
Variant(val, [range])
:is_integer()
:is_real()
:is_string()
:is_ip_address()
.integer
.range
.fraction
.real
.string
.ip_address
creates a Variant, val can be a number or a string. If it is a number then including range will create an Integer Variant, otherwise it is a Real Variant returns a boolean (true if the Variant is an integer and false if it isn't) returns a boolean (true if the Variant is a real number and false if it isn't) returns a boolean (true if the Variant is a string and false if it isn't) returns a boolean (true if the Variant is an IP Address and false if it isn't) getter/setter for integer values getter/setter for the range of an integer value getter/setter for an integer converted to a fraction getter/setter for real values getter/setter for string values getter/setter for IP Addresses (a string in dotted decimal form e.g."192.168.1.23")
When a variant is returned by a function, you can run one of the above functions to determine the data type or use a variable to get the data out of the object: get_trigger_variable(1).integer
For more details, see
Timeline Management
Note:
The default fade time for these is 2 seconds unless specified.
stop_all([fade]) stop_all_timelines([fade]) get_timeline(num)
:start()
:stop([fade])
:pause()
:resume()
:set_default_source()
:set_timecode_source( bus [, offset])
:set_audio_source( bus , band, channel [,peak])
.name
.length
stops all timelines and scenes running in the project stops all timelines with optional fade time returns a Timeline object starts the timeline stops the timeline with optional fade time pauses the timeline resumes the timeline set which bus is used for the timeline's position set the timecode bus with optional offset set the time source of the timeline to an audio bus.
returns the timeline's name returns the timeline's length
- 596 -
Lua API (Triggering)
.source_bus
.timecode_format
.audio_band
.audio_channel
.audio_peak
.time_offset
.is_active
returns information about the timeline's time source (depending upon which source is configured)
.is_running
.is_onstage
.is_released
returns a boolean value based on whether the timeline is reporting as active returns a boolean value based on whether the timeline is reporting as running returns a boolean value based on whether the timeline is reporting as onstage returns a boolean value based on whether the timeline is reporting as released returns a boolean value based on whether the timeline is reporting as halted or paused returns the current position of a timeline returns the timeline's priority
.is_halted
.position
.priority
Timecode Bus Options:
l l l l l l
TCODE_1
TCODE_2
TCODE_3
TCODE_4
TCODE_5
TCODE_6
Audio Bus Options:
l l l l
AUDIO_1
AUDIO_2
AUDIO_3
AUDIO_4
Audio Channel Options:
l l l
LEFT
RIGHT
COMBINED
Scene Management
Note:
The default fade time for these is 2 seconds unless specified.
stop_all([fade]) stop_all_scenes([fade]) get_scene(num)
:start()
:stop[fade]) stops all timelines and scenes running in the project releases all scenes being played back returns a Scene object starts the scene stops the scene with optional fade time
- 597 -
Pharos Designer User Manual
:toggle()
.is_onstage
toggles the scene returns a boolean value based on whether the scene is onstage
Overrides
Note:
Overrides default to IRGB levels of (0,255,255,255), and if you don't change a level it will be at its default value.
Note:
The default fade time for these is 2 seconds unless specified.
clear_all_overrides([fade])
:set_green(green [, fade[, crossfade ]])
:set_blue(blue [, fade[,
:clear() crossfade ]])
Clears all overrides with optional fade time get_group_override(num) get_fixture_override(num)
:set_irgb(intensity,red, green, blue
[, fade[, crossfade ]]) returns an override object for the specified group number returns an override object for the specified fixture number overrides the IRGB values with those specified, with an optional fade time and crossfade path
:set_intensity(intensity, [, fade
[, crossfade ]])
:set_red(red [, fade[, crossfade ]]) overrides the fixtures intensity with the specified value with an optional fade time and crossfade path overrides the red value with the specified value, with an optional fade time and crossfade path overrides the green value with the specified value, with an optional fade time and crossfade path overrides the blue value with the specified value, with an optional fade time and crossfade path clears all overrides from the group/fixture
Crossfade Paths:
l l l l l l l l
"Linear"
"NonDim"
"5% Preheat"
"10% Preheat"
"Accelerate"
"Brake"
"Damped"
"Square Law"
Inputs
get_input(input) get_dmx_input(channel) get_rio( type , number)
:get_input(input)
RIO Types:
l l l
RIO80
RIO44
RIO08 returns the state of the local controller's inputs (true = high, false = low) returns the level of the dmx input channel returns a RIO object returns the state of the RIO's inputs (true = high, false = low)
- 598 -
Lua API (Triggering)
Lighting Outputs
get_dmx_universe(index) get_artnet_universe(index) get_pathport_universe(index) get_sacn_universe(index) get_kinet_universe(powersupply, port)
:park(channel,value)
:unpark(channel)
:get_channel_value(channel) returns a universe object for the specified universe number returns a universe object for the specified universe number returns a universe object for the specified universe number returns a universe object for the specified universe number returns a universe object for the specified power supply (power supply number in Patch) and port number parks the specified channel unparks the specified channel returns the current value of the specified channel
TPC
set_control_caption(controlName, value) set_control_state(controlName, name) set_control_value(controlName[, index], value[,executeChangeTriggers]) set_interface_page(num) set_interface_locked([lock]) set_interface_enabled([enable])
Project Properties
get_current_project()
.name
.author
get_current_controller()
.number
.name
Remote Devices
set the control caption to value = "string" set the control state to name ="state name" set the control value to value with optional index, and optionally execute change triggers sets the local TPC to the specified page number locks the local TPC, lock = boolean, default = true enables the local TPC, enable = boolean, default = true returns a project object returns the project name returns the project author returns a controller object returns the controller's number returns the controller's name get_bps(num)
:get_state(button)
:set_led(button, effect [, intensity]
[, fade]) returns a BPS object returns the current state of the specified button as an integer:(0 =
Pressed, 1 = Held, 2 = Repeat, 3 = Released ) set the specified button to an effect with optional intensity and fade time
Button Effects:
l l l l
OFF
ON
SLOW_FLASH
FAST_FLASH
- 599 -
Pharos Designer User Manual l l l l l l
DOUBLE_FLASH
BLINK
PULSE
SINGLE
RAMP_ON
RAMP_OFF
Others
enqueue_trigger(num[,variables]) get_resource_path(filename) set_timecode_bus_enabled( bus ,
[enable]) get_trigger_variable(index) log(string) push_to_web(name,value) set_text_slot(name, text) get_text_slot(name) is_controller_online(controller_number)
Timecode Bus Options:
l l l l l l
TCODE_1
TCODE_2
TCODE_3
TCODE_4
TCODE_5
TCODE_6 enqueue trigger num, optionally passing variables returns the path to a file on the SD card (see storing data example) enables the specified timecode bus, enable = boolean returns a
captured by a trigger writes string to the controller's log sends a variable to the web interface in JSON format, eg. { name : value } sets the value of text slot "name" to "text" returns the current text within a text slot returns true if the specified controller has been detected online
Time Namespace
All the functions below must start with "time."
Note:
time is a reserved variable name. If you create a Lua variable called time, it will prevent these functions from running time.get_current_time() time.get_sunrise() time.get_sunset() time.get_civil_dawn() time.get_civil_dusk() time.get_nautical_dawn() time.get_nautical_dusk() time.get_new_moon() time.get_first_quarter() time.get_full_moon() time.get_third_quarter()
.year
returns a date/time object returns a date/time object returns a date/time object returns a date/time object returns a date/time object returns a date/time object returns a date/time object returns a date/time object returns a date/time object returns a date/time object returns a date/time object returns the year of the date/time object
- 600 -
Lua API (Triggering)
.month
.monthday
.weekday
.hour
.minute
.second
.utc_timestamp
time.is_dst
time.gmt_offset
returns the month of the date/time object returns the day of the month of the date/time object returns the day of the week of the date/time object (0 = Sunday, 1 =
Monday etc.) returns the hour of the date/time object returns the minute of the date/time object returns the second of the date/time object returns the utc_timestamp of the date/time object returns true if the current location is in DST returns the GMT offset for the controller's location
Example
The script below will from a string in the format hh:mm containing the current time returned by the controller
NOW = time.get_current_time().hour .. ":" .. time.get_current_time().minute
Hardware Namespace
All the functions below must start with "hardware."
Note:
hardware is a reserved variable name. If you create a Lua variable called hardware, it will prevent these functions from running hardware.get_last_power_on() hardware.type
hardware.channel_capacity
hardware.serial_number
hardware.memory_total
hardware.memory_used
hardware.memory_free
hardware.memory_card_size
hardware.bootloader_version
hardware.firmware_version
hardware.reset_reason
hardware.ip_address
hardware.subnet_mask
hardware.default_gateway
returns a date/time object (see above) returns the controller's type returns the controller's channel capacity returns the controller's serial number returns the controller's total memory returns the controller's used memory returns the controller's free memory returns the controller's memory card size returns the controller's bootloader version returns the controller's firmware version returns the controller's reset reason returns the controller's IP address returns the controller's subnet mask returns the controller's default gateway
- 601 -
Download
Anúncio