CueServer 2 provides up to eight built-in buttons. These buttons can be assigned to various functions or cues. In this tutorial, we show you how to use more than one function with each button by using a "Shift Button" to toggle functionality.

Shift Keys



The Scenario


You use CueServer in your building and have eight lighting cues that your employees run depending on the situation. Occasionally, you have a need for eight additional cues, however, you only have access to the eight built-in buttons on CueServer.


You want a way to toggle between the standard eight functions and the additional eight functions when you need to access them.




The Process


First, we will need to create 16 cues; eight for our normal use and eight for our non-typical use.

Next, we need to attach these 16 cues to our buttons. To allow for the use of 16 cues with eight buttons, we need to set up a shift key that will toggle the functionality of each button when we press-and-hold button eight. We will use If..Then statements in each of our buttons' rules to see if our functions have been "Shifted" and then execute the appropriate cue.




The Walkthrough


In the video below, we go through the whole process. This will show you how to set up the "shifted" variable, the button rules, and the shift button.

If you'd rather take it step by step, we will do that below, just after the video.




The first step (assuming the 16 cues have already been created) is to set up the "shifted" variable.

In the Variables panel (located on the left-hand side of the CueServer Studio editor panel), we will add the variable shifted. We need to set this variable's current & default values to 0 as well as ensure it is set to non-volitile by checking the box on the far-right (Meaning the variable and it's value persists through a system reboot or show change).

We will use this variable to track which cue each button will launch. The 8th button will be used additionally as a toggle for this variable when pressed-and-held. More on this later.

Add 'shifted' to the variables panel

The next step is to set up our button rules.

Each button rule (using the Perform Script modifier) will use an If...Then statement to decide which cue to launch. The code we will use for our 1st button rule is

 If ('shifted') Then
    Cue 9 Go
  Else
    Cue 1 Go
  EndIf


We will repeat this code thru button 7, only changing the cue numbers accordingly.

Button 1 Rules
Button 2 Rules
Button 7 Rules

For button 8 we will use the same code, however, we will use the action Released rather than Pressed as well as the Was Not Held modifier beacuse we will also be using button 8 as our toggle key. The reason we need the release action is to prevent launching the 8th or 16th cue while trying to toggle the shift functionality.

Button 8 Rules

Lastly, we need to set up our shift function on button 8.

To do this, we'll use the Held action in a second Whenever rule (added using the + button to the right of the rule we just created) with the following code:

"shifted" = ('shifted' == 0)
 button 1>8
 If ('shifted') Then
    set button.OffColor {255,0,0}
 Else
    set button.OffColor {0,0,255}
 EndIf


The first line toggles the value of 'shifted' between 1 and 0 (true and false). The second line selects all of the buttons (for use in the next code block). The final block sets the color of the buttons to either Red or Blue to indicate whether the buttons have been shifted or not.

Button 8 Toggle Rules



Conclusion


The variable we created will keep track of whether the buttons are shifted or not. Each button rule will check the variable when pressed and will run the cue with an offset of 8 (e.g., button 1 runs cue 1 OR 1+8=9) if the buttons are shifted. When button 8 is held, the value of the 'shifted' variable is toggled and the buttons' backlit color changes to indicate whether the buttons are shifted or not.