Advanced Control Tree

Q-SYS Control 101 Training : Scripting Basics

3 ) Simple Communication

15m 13s

4 ) Feature License Activation

4m 12s

5 ) Block Controller

19m 7s

7 ) Flow Control

34m 20s

8 ) Control 101 Conclusion

1m 42s

Lesson Description

Advanced Control Tree 7m 27s

Explore more of each control's metadata properties available in its Control Tree.

Video Transcript

Advanced Control Tree 7m 27s
0:08
Now that we’ve added controls into our scripting environment, let’s look at some more of each
0:13
control’s metadata available through its Control Tree. By now you should be very familiar with
0:18
.Value, .String, and .Position for most controls, so next let’s look at some more of these properties. In
0:25
upcoming videos we’ll explore how we can create functions to actually change each property, but for
0:31
now let’s just make sure we know what properties are at our disposal.
0:35
First, there are some visual options. .Color, for instance, changes the main visual color of the control.
0:42
You might find it useful to change a fader’s color when it approaches the limits of its range, for
0:47
instance, or when its channel is muted.
0:51
The .Color property can be represented by hex color codes, as well as all web-safe HTML color names.
1:00
In the Block Controller, you can set this with the “Set Control Visual” block. If you don’t like any of
1:07
these 70 colors, you could use a different selection option here in the Values category.
1:14
And if we look at the Lua generated by this Block Controller, we can see that we’re simply assigning a
1:20
value to the .Color control tree.
1:24
The .Legend property refers to the control’s label. This is different than the name you provided when
1:31
you created the control, Kevin, which cannot be changed by the script.
1:35
The Legend is the same thing as typing on a control to rename it, but since you can change the
1:41
Legend dynamically with scripting, this is a great way to change a button’s label based on its status.
1:48
In the Block Controller, you’ll find this represented by another “Set Control Visual” block. These “Set
1:55
Control Visual” blocks are all the same block with a different visual preselected, so I could simply
2:01
change this drop-down here to change its target.
2:05
While we’re here, let’s actually look at these other ones. .IsInvisible is a property that can be
2:11
set to either “true” or “false” to make a control invisible or visible again. You might use this,
2:17
for instance, to hide certain telephone controls on a UCI when the telephone is in use.
2:23
Similarly, the .IsDisabled visual choice will make a control semi-transparent and non-interactive. This
2:31
lets the user know they can’t currently engage that control in its current state.
2:36
The .IsIndeterminate property is another example of a disabled button, although you’re less likely to
2:42
force this state upon a control as you are to read this property from a control.
2:49
When a peripheral device is not connected to the network, for instance, its controls take on this
2:54
faded red color, which is the result of being Indeterminate. It means the system cannot determine
3:00
the connection between the control and its parent device, and thus it Is Indeterminate.
3:07
Let’s say you’re monitoring a fire alarm contact closure on an IO frame – you could monitor both the
3:12
control’s Value for any sign of a fire alarm, as well as the .IsIndeterminate property. Because if this
3:20
property becomes true, then you know you no longer have a connection to that device, which means
3:25
your fire alarm system won’t work.
3:28
You might notice that a Knob has its .Value, .String, and .Position properties available here in the
3:35
Block Controller, but a Toggle Button has something different – it has a property called .Boolean. For
3:42
a control that only has two states like a binary button, .Boolean essentially represents its Value.
3:49
When referenced on its own, .Boolean is assumed to be true, but you could change .Boolean to false
3:56
to deactivate the control. In Lua script, however, you can reference a button’s .Boolean property as
4:02
well as its .Value property, or .String, and.Position.
4:07
For input controls, there’s a very important control tree property you’ll see a lot in upcoming videos:
4:14
.EventHandler.
4:16
In a world full of events, someone has to handle them! "Consider it… handled."
4:25
A Control’s EventHandler is triggered whenever the control’s state is changed. Basically it’s the
4:31
indicator that something has occurred, which you could use to initiate an action. This only makes
4:38
sense as an incoming control tree - and we’ll use it a lot when we start writing functions.
4:43
If you want something to occur when the button is pressed, you’ll use the .EventHandler to make
4:48
that happen. In the Block Controller, this is represented by this “on control change” block, which – if
4:57
we look at the Lua generated - is the beginning of a function, initiated by our good friend the
5:02
.EventHandler.
5:04
Certain types of controls have the .Values property – that’s plural Values, which is different than
5:11
.Value. For instance, a Meter could deliver both a peak and average value as an array using this.
5:18
There’s also a .Choices property for controls with drop-down selection menus.
5:25
For Output Controls, you might use the .RampTime property to set a length of time for a control to
5:32
change from one value to another, so the next time you set that control’s .Value or .Position it will
5:39
take this amount of time to arrive there. The .RampTime property is expressed in seconds.
5:47
Finally, let’s look at Trigger buttons. We’ve said a few times that Triggers are unique because they
5:53
don’t have Values, Strings or Positions. Normally you could change a control’s state by adjusting
5:59
those properties, but for a Trigger you’ll need to do this: Control:Trigger().
6:08
Notice the use of a colon instead of a period here. The colon indicates a method, rather than a
6:14
property. A method is an action that a control can perform. You don’t have to set the :Trigger to true
6:23
or false, the colon is all you need to activate this method.
6:28
There are a number of Control Tree methods you’ll find for certain controls. You’ll see them when
6:34
you start dealing with Timers which have a :Start and :Stop method, or TCP Connections that have
6:41
methods such as :Connect, :Disconnect, etc.
6:45
We won’t get into the creation of Lua TCP connections in this online control training, because it’s
6:51
much easier to use the Block Controller to send and receive strings across the network. And if you
6:57
want to activate a Trigger in block controller, you’ll find a specific block for that control
7:02
which activates its method.
7:05
Alright, we’ve gone as far as we need to in the Control Tree for now, so let’s go back to the Control
7:09
Worksheet. There’s no real exercise for this one, just a demonstration of some of these properties.
7:14
Take a look, and then we’ll finally get to move forward with creating some functions, so that your
7:20
script can actually do something! Move on whenever you’re ready.