Control Script
The Control Script component is used to write scripts, using the Lua language, for control and monitoring from within Q-SYS Designer. You can change or monitor the position, value, string, metadata and other attributes of controls. The script you write interacts with components through their control pins.
For more about scripting in Q-SYS, see Control Scripting. Refer to the Lua 5.3 Reference Manual for information about native Lua commands supported in Q-SYS.
Note: This component uses the Q-SYS Scripting Engine, which is a licensed feature on certain Cores manufactured with Q-SYS 7.0 and later. For more information, see Licensing.
The Control Script component is defined, in the component Properties, by the number of inputs and outputs. The body of the script is written in the Control Script Control Panel.
- Refer to the Q-SYS Lua Environment and the Lua 5.3 Reference Manual topics for information about writing scripts.
- Click the Search bar on the right side of the page to locate text in your script. As a shortcut, press F3 to find the next item.
If you open a Q-SYS 3.3 or earlier design containing a Control Script component in Q-SYS 4.0 or later, the component with become a Control Script v1 component. The existing v1 script will continue to function as before. However, if the v1 script is pasted into a newly placed Control Script component, it will most likely fail. We have made it simpler to convert a v1 script to v2 by adding a property to the Control Script v1 block by adding a property to use the New Script Engine (Yes/No). This is to avoid having to copy and paste code to a v2 Script component.
See Debug Output.
Property |
Function |
Choices |
---|---|---|
Input Count |
Sets the number of inputs. |
0 to 512 |
Serial Input Count |
Sets the number of serial connections. Use with the Core, I/O Frame, and Page Station Serial Port components. |
0 to 512 |
Output Count |
Sets the number of outputs. |
0 to 512 |
Virtual Serial Output Count |
Sets the number of virtual serial output pins. Use these pins with the SerialServerPorts Lua library. |
0 to 512 |
When you double click the Control Script component, the script editing tab displays.
Control |
Function |
---|---|
Script Area |
Text-edit area to write script. You can edit the script in the Design, Emulate, or Run modes, but any errors are only detected in the Run or Emulate modes. Tip: While in the Script area, press F1 for help on the Lua scripting language. |
Information bar at the top of the script |
Click the yellow "Save changes" bar to reload (not run) the script. Syntax errors are indicated in a red bar at top-right, as well as in the Debug Output area. |
The available Control Pins depend on settings in Properties.
Pin Name |
Function |
Pins Available |
---|---|---|
Code |
Text input and output. Allows you to enter code. |
Input / Output |
Script Start |
Starts the script running. |
Input / Output |
Script Status |
Current status of the script. |
Output |
Script Stop |
Stops the script. |
Input / Output |