Global Variables

<< Click to Display Table of Contents >>

Navigation:  DeltaGUI Application Walkthrough > Building a Show by Combining Resources > Using Sequences >

Global Variables

You can add and use your own variables that can be used in any sequence. Select the Global Variables tab in the Sequence Editor and click the + Add button. These variables are created in the server and persist after closing.

The same dialog can be returned to, to edit a variable, by double clicking the variable name:

Variables can also be created, set and read by sequences (see: ‘Global Variable Commands’ in Help).

Parameters

You can choose any name for the global variable, and it can be one of the following styles:

Int
whole number, value in the range -2147483648 to +2147483647

Float
floating point 1.17 × 10-38 to 3.4 × 1038

String
character array, up to 128 characters in length.

Attributes:

Read Only
Check this if the value cannot be changed within a sequence.

Watched
Check this if you want to be able to see the current value in the debugging panel (as shown above; switched on in the Edit tab).

Using Variables

Variables can be used in sequences to control playback or media, for example this sequence creates and initialises a global variable (similar to adding via the dialog above) to keep track of which timeline is active:

Sequence InitialiseVars:

globalvar $i_ WhichTimeline = 0

This sequence then uses these variables to control show playback when the sequence is triggered (from external control, from the timeline or from the buttons in the sequence editor).

Sequence ShowControl:

if ($i_ WhichTimeline =1)
 {
 play tl=2
 sequence TL1AudioDown
 sequence TL1VideoDown
 delay 1000
 stop tl=1
 $i_ WhichTimeline =2
 }
else
 {
 play tl=1
 sequence TL2AudioDown
 sequence TL2VideoDown
 delay 1000
 stop tl=2
 $i_ WhichTimeline =1
 }

This sequence interrogates the $i_ WhichTimeline variable and if it is 1, plays timeline 2, triggers off other sequences which fade down timeline 1, then stops timeline 1 after a delay. It then sets the $i_ WhichTimeline to 2 so that the next time the same sequence is called, the Else part is called to reverse the actions and start timeline 1 while stopping timeline 2.

A further example is a realtime clock, where a text resource is placed on the timeline and this sequence is triggered (once only, since it keeps running) to update the text resource contents with a string representing the current local time:

Sequence RTC:

#start
$mystringvar2=$currenttime
textparams MyRTC $mystringvar2 150 255 255 0 tl=1

Delay 500ms
gotolabel #start

In this sequence, the $mystringvar2 is a String type variable (previously created in a sequence or the editor), and it is set to the reserved variable ‘$currenttime’ which fills it with (for example) 10:20:41. The Textparams command then sets the resource named ‘MyRTC’ to this value and the text size is 150, the colour is 255,255,0 (yellow) and the timeline is 1.

Code Syntax

Page edited [d/m/y]: 08/12/2020