Skip to main content

Overview

The Color Sweep Update plugin (also known as “Delay Sweeps - Preset Updater”) creates and updates delay-based sweep presets for color effects. It generates presets for horizontal and vertical sweeps in multiple directions, enabling sophisticated chase and wave effects.
This plugin was created by Jason Giaffo and is copyright property of Giaffo Designs. Version 1.8.1, last updated May 30, 2019.

Configuration Variables

chaserWings
boolean
default:"false"
Doubles wavelength for wings to maintain consistent distance between unidirectional and bidirectional sweeps. Values: true or false (no quotes)
presetTypes
table
default:"{4}"
Preset type numbers to apply delays to. Use {0} for all preset types, or specific types like {4, 5, 6}
presetStart
number
default:"500"
Starting preset number for delay presets
presetFinish
number
default:"553"
Ending preset number for delay presets
delaytime_list
table
default:"{0, 0.25, 0.5, 1, 2, 5}"
Array of delay times in seconds to create presets for

Interactive Setup

The plugin prompts for row group assignments:
Row Group Numbers
multiple
Group numbers representing fixture rows, entered sequentially (press Enter without input when done)

What Gets Created

The plugin creates delay presets in 9 different patterns:

Horizontal Patterns

  1. (Left to Right): Delay 0 Thru [time]
  2. (Right to Left): Delay [time] Thru 0
  3. (Center Out): Delay [time/2] Thru 0 Thru [time/2]
  4. (Outside In): Delay 0 Thru [time/2] Thru 0

Vertical Patterns

  1. Up: Delays increase from bottom to top
  2. Down: Delays increase from top to bottom
  3. V. Out (Vertical Out): Delays from center rows outward
  4. V. In (Vertical In): Delays from outer rows to center

Random Pattern

  1. SHUFFLE: Random fixture order with delays

Preset Count

For 6 delay times:
  • Horizontal: 4 directions × 6 times = 24 presets
  • Vertical: 4 directions × 6 times = 24 presets
  • Random: 1 direction × 6 times = 6 presets
  • Total: 54 presets (per preset type)

Usage

1

Configure variables

Edit the configuration at the top of the plugin file:
local chaserWings = false
local presetTypes = {4}  -- Color presets
local presetStart = 500
local presetFinish = 553
local delaytime_list = {0, 0.25, 0.5, 1, 2, 5}
2

Run the plugin

Execute the plugin:
Plugin "ColorSweepUpdate"
3

Confirm execution

Confirm the update when prompted:
Update Delay Presets?
Are you sure you want to update delay time presets?
Press [OK] to continue.
4

Enter row groups

Enter group numbers for each row:
DS Group #: 10
Row 2 Group #: 11
Row 3 Group #: 12
Row 4 Group #: [press Enter to finish]
5

Monitor progress

The plugin displays a progress bar while creating presets:
Assigning Delay Preset Values
[Progress bar: 0 to timeCt]
6

Completion

When finished, a confirmation appears:
Update Completed
Preset 0.[start] Thru 0.[finish] updated.

Preset Naming Convention

Presets are labeled with the format:
[time]s [direction]
Examples:
  • "0.25s >>" - 0.25 second delay, left to right
  • "1s <<" - 1 second delay, right to left
  • "2s V. Out" - 2 second delay, vertical center out
  • "5s SHUFFLE" - 5 second delay, random order

Function Reference

Main Function

main()

Main execution function that orchestrates the entire preset creation process.
local function main()
  -- Confirm execution
  -- Gather row groups
  -- Generate division arrays
  -- Calculate delay times
  -- Create presets with progress bar
  -- Lock preset range
end

Cleanup Function

cleanup()

Cleans up progress bars if plugin is interrupted.
local function cleanup()
  for k, v in pairs(pBars) do
    v:stop()
  end
end

Helper Functions

getGroup(grpNum)

Exports group to XML, parses fixture/channel list, and returns array.
function getGroup(grpNum)
  -- Export group to temp XML file
  -- Parse XML for fixture/channel IDs
  -- Handle subfixtures
  -- Return groupList array
end

trunc(num, mod)

Truncates number to specified precision (used for delay rounding).
function trunc(num, mod)
  local x = num - (num%mod)
  return x
end

confirm(title, message_box, message_text)

Shows confirmation dialog with version compatibility.
local function confirm(title, message_box, message_text)
  -- Check MA2 version
  -- Use confirmation box or text input based on version
  return boolean
end

msgbox(title, message_box, message_text)

Shows message box with version compatibility.

Advanced Functions

createPlugin(num, name, script, EOL)

Dynamically creates and imports plugins (used internally).

checkSpace(poolType, start, length)

Checks if range of pool spaces is empty.

advanceSpace(poolType, start, length, pad_before, pad_after)

Finds next available space in pool with padding.

Delay Calculation

Horizontal Delays

Applied across entire group using MAtricks-style syntax:
-- Left to Right
cmd('PresetType '..pTypes_str..' At Delay 0 Thru '..timeList[i])

-- Right to Left
cmd('PresetType '..pTypes_str..' At Delay '..(timeList[i] * chaserWings_mult)..' Thru 0')

-- Center Out
cmd('PresetType '..pTypes_str..' At Delay '..(timeList[i] * chaserWings_mult)..' Thru 0 Thru '..(timeList[i] * chaserWings_mult))

-- Outside In
cmd('PresetType '..pTypes_str..' At Delay 0 Thru '..(timeList[i] * chaserWings_mult)..' Thru 0')

Vertical Delays

Calculated proportionally based on row position:
-- Calculate proportion for each row
local divCt = #groups - 1
local interval = 1 / divCt
local proportion = 0

for grp = 1, #groups do
  divisions[3][grp] = proportion
  proportion = proportion + interval
end

-- Apply to create delay times
for grp = 1, #divisions[dir] do
  divisionTimes[dir][time][grp] = timeList[time] * divisions[dir][grp]
end

Wing Delays

For vertical wings (center out/in):
local divCt = math.ceil(#groups/2) - 1
local interval = chaserWings_mult / divCt
local proportion = chaserWings_mult

-- Assign same delay to paired rows
cmd('Group '..rows[grpAct1]..' + '..rows[grpAct2])
cmd('PresetType '..presetTypes[i]..' At Delay '..trunc(divisionTimes[set][time][grp], 0.001))

Classes

ProgressBar Class

Custom progress bar implementation:
local ProgressBar = {
  new = function(self, name)
    -- Create progress bar handle
  end,
  
  set = function(self, num, add)
    -- Set progress value
  end,
  
  setrange = function(self, bottom, top)
    -- Set progress range
  end,
  
  settext = function(self, text)
    -- Set progress text
  end,
  
  time_move = function(self, target, time, add, ignore_top)
    -- Animate progress over time
  end,
  
  stop = function(self)
    -- Stop and close progress bar
  end
}

ST Class (String Table)

Custom table class with helper methods:
local ST = {
  append = function(self, v)
    -- Append value to table
  end,
  
  concat = function(self, sep, i, j)
    -- Concatenate table values
  end,
  
  shuffle = function(list)
    -- Shuffle table values
  end
}

Example Configuration

4-Row Color Sweep

-- Configuration
local chaserWings = true  -- Enable wing wavelength doubling
local presetTypes = {4}   -- Color presets only
local presetStart = 500
local presetFinish = 553
local delaytime_list = {0, 0.25, 0.5, 1, 2, 5}

-- Row groups during execution
DS Group #: 1
Row 2 Group #: 2
Row 3 Group #: 3
Row 4 Group #: 4
Row 5 Group #: [Enter]
Results in:
  • 54 presets (500-553)
  • 6 delay times × 9 directions
  • All presets applied to preset type 4 (Color)

Preset Range Management

The plugin manages presets safely:
-- Unlock before modification
local presetRange = 'Preset 0.'..presetStart..' Thru 0.'..presetFinish
gma.cmd('Unlock '..presetRange)

-- Create/update presets
-- ...

-- Lock after completion
gma.cmd('Lock '..presetRange)

Store Options

All presets are stored with specific options:
local storeOptions = ' /s /o /so=Prog /use=Active /v=false /vt=true /ef=false'
  • /s - Selective (only store active attributes)
  • /o - Overwrite existing
  • /so=Prog - Store from programmer
  • /use=Active - Use active values
  • /v=false - No value verification
  • /vt=true - Store value types
  • /ef=false - No effect fade
This plugin will overwrite presets in the range presetStart to presetFinish. Make sure this range is available or contains presets you want to replace.
The plugin requires groups to be set up representing fixture rows. Minimum 1 row required, but vertical effects require at least 2 rows (wings require at least 3 rows).
The plugin includes version compatibility for grandMA2 3.1.2.x, which has known issues with confirmation dialogs. It automatically uses text input instead of confirmation boxes on affected versions.
Set chaserWings to true when you want bidirectional waves (center-out, outside-in) to have the same visual speed as unidirectional waves (left-right). This doubles the wavelength for wing patterns.
You can create delay presets for multiple preset types simultaneously by setting presetTypes = {0} for all types, or specific types like {4, 5, 6} for Color, Beam, and Focus.
For smooth color chases, use delay times around 0.25-0.5 seconds. For dramatic sweeps, use 1-2 seconds. For slow builds, use 5+ seconds.

Build docs developers (and LLMs) love