#UnO2 Variables to save memory #UnO2


Michael Schultz
 

How can I use a set of variables to save memory?

I have a device that changes midi commands to DMX to control lights.  I have about 50 presets (songs) that I have to control 6 devices (settings for each song).  I am at 84% capacity.  Now I want to add the MIDI Settings (CC messages for two strings of lights that I was hoping to be able to change for each Present (song).  Each CC message is for a different DMX Channel.  Looks like this:

//Light String One//
   SendMidi Lights CtrlChange 000 127
   SendMidi Lights CtrlChange 001 127
   SendMidi Lights CtrlChange 002 000
   SendMidi Lights CtrlChange 003 000
   SendMidi Lights CtrlChange 004 000
   SendMidi Lights CtrlChange 005 000
   SendMidi Lights CtrlChange 006 000
   SendMidi Lights CtrlChange 007 000
//Light String two//
   SendMidi Lights CtrlChange 020 127
   SendMidi Lights CtrlChange 021 000
   SendMidi Lights CtrlChange 022 000
   SendMidi Lights CtrlChange 023 000
   SendMidi Lights CtrlChange 024 000
   SendMidi Lights CtrlChange 025 000
   SendMidi Lights CtrlChange 026 127
   SendMidi Lights CtrlChange 027 052

While I do not need to send all channels for every song, I am quickly running out of available memory.  I was wondering if/how to use variables to maybe set up 5 to 10 lighting scenes using variables and just call the one I want in a preset.  I am struggling to determine 1. If this is possible (I would think so).  If so what is the syntax to use to add the text of a variable to my existing preset to be sent.


For example:

VAR $RED = "   SendMidi Lights CtrlChange 000 127
   SendMidi Lights CtrlChange 001 127
   SendMidi Lights CtrlChange 002 000
   SendMidi Lights CtrlChange 003 000
   SendMidi Lights CtrlChange 004 000
   SendMidi Lights CtrlChange 005 000
   SendMidi Lights CtrlChange 006 000
   SendMidi Lights CtrlChange 007 000
   SendMidi Lights CtrlChange 020 127
   SendMidi Lights CtrlChange 021 000
   SendMidi Lights CtrlChange 022 000
   SendMidi Lights CtrlChange 023 000
   SendMidi Lights CtrlChange 024 000
   SendMidi Lights CtrlChange 025 000
   SendMidi Lights CtrlChange 026 127
   SendMidi Lights CtrlChange 027 052"

VAR $BLUE = "   SendMidi Lights CtrlChange 000 127
   SendMidi Lights CtrlChange 001 000
   SendMidi Lights CtrlChange 002 000
   SendMidi Lights CtrlChange 003 127
   SendMidi Lights CtrlChange 004 000
   SendMidi Lights CtrlChange 005 000
   SendMidi Lights CtrlChange 006 000
   SendMidi Lights CtrlChange 007 000
   SendMidi Lights CtrlChange 020 000
   SendMidi Lights CtrlChange 021 000
   SendMidi Lights CtrlChange 022 127
   SendMidi Lights CtrlChange 023 000
   SendMidi Lights CtrlChange 024 000
   SendMidi Lights CtrlChange 025 000
   SendMidi Lights CtrlChange 026 127
   SendMidi Lights CtrlChange 027 052"

How do I add one of these to VARs to a preset...I think it would save me a lot of memory.

PRESET Blue on Black = 
{
   SendMidi VoiceLive ProgChange 53
   SendMidi LOOPER ProgChange 53
   SendMidi GR55 CtrlChange 0 0 
   SendMidi GR55 ProgChange 53
   SendMidi SY1000 CtrlChange 0 0 
   SendMidi SY1000 ProgChange 53
   SendMidi LP ProgChange 53
   SendMidi BB ProgChange 53
   $RED
}


Thanks in advance


ossandust
 

Hi,
variables can be used to store numeric values (0-127), boolean values (true/false), or small string values (like preset names for instance). They cannot store a complete script. 
What you want to use instead are "triggers". Next to their regular purpose (to create a momentary effect switch) they can also be used to contain a set of commands which you want to reuse in several presets.
So all you need to do is change "VAR  $RED = ..." into TRIGGER_CLICK RED = { ... } 
and in the presets you can then use the command "SendTrigger RED" 


Michael Schultz
 

This works like a charm, and with the TRIGGERs I have split colors and functions into separate triggers making the footprint even smaller with so many more options.

Thank you ossandust!