Using Colors with Variables

Variables have long been crucial to logic and programming. Simply put, they allow the allocation and retrieval of temporary memory in various forms and can be a very present help in a wide array of applications, such as logic gates, state maintenance, or simple storage.

One of the most typical uses of variables in CueServer might be the storage of one or more aspects of show state for use in If...Then statements. There are three ways to use user-defined variables in CueServer in addition to the system, or global, variables. If you're not familiar with these, you can check out this article for a rundown.

In this article, we'll focus on how you can use them to store custom colors for use in lighting looks.


For a more in-depth technical analysis of user variables, check out the variables section of the manual.

For more on System Variables, used for setting system parameters and settings, take a look at this section.

The Scenario

In your venue, you use ambient lighting to mimic the circadian cycle indoors. To pull this off, you use timers based on the sunrise/sunset times. You must set up several cues to accomplish the changing colors throughout the day. You would like to have a better way of managing this color change than using multiple near-identical cues.

The Breakdown

The solution here is to use variables! Rather than creating multiple cues, each storing slightly different colors across the same range of channels, you can use a single cue in concert with a variable. This lets you capitalize on the powerful cue fade-engine to transition through the color changes while not having to maintain multiple copies of a similar cue. To do this, we use the same timers to trigger the change in color throughout the day, however, rather than call a different cue for each change, we simply update the color variable to the new color and allow the cue to manage the rest.

The Walkthrough

The Walkthrough

Step One

First, we need to adjust our timers so that they update the variable rather than call a cue. In CueScript, you can apply an array of values across any range of channels. To define an array, you place array items inside curly brackets { } separated by commas. In this case, we'll be working with RGB fixtures so we'll be using an array with a length of three; Red, Green & Blue.

Normally, you would apply such a range with the AT command. For instance, to apply a warm red across three RGB fixtures (addressed channels 1-3,3-6,7-9 in this example), you would use:

Channel 1>9 At {100,20,20}

For this show, we'll be using the variable "ambientLight" to store our color value array.

In our example, we created several timers througout the day, offset incrementally from the astronomical clock's sunset and sunrise, accordingly. This ensures the variable is adjusted at the appropriate times throughout the year.

Once we've set our timers up like so, we'll move on to step two.



Step Two

Next, we need to create our ambient lighting cue. This cue will run throughout the day and maintain lighting at the currently selected color.

Because the timers we used here are updated on a 60-minute interval, give-or-take, we'll set the cue to fade over 1 hour (3600 seconds) using the time command ('t') and follow after 1 hour. This will allow a slow fade to the currently set color over an hour, with each hour adjusting the target values to the current value of our "ambientLight" variable.

We'll also set the Link to the same number as our cue so that it links back to itself and repeats each hour.


Have a Tip or Trick you would like to see? Let us know!

That's all there is to it! Of course, there are endless ways to use variables in CueServer and this only covers one possible use.

Have you done anything interesting using variables in CueServer? We would love to hear about it! Let us know.