78 lines
2.4 KiB
Lua
78 lines
2.4 KiB
Lua
local debug_mode = true
|
|
|
|
local function debug_print(message)
|
|
if debug_mode == true then
|
|
Printf(tostring(message))
|
|
end
|
|
end
|
|
|
|
local function split_first(inputstr, sep)
|
|
local sep = sep or ";"
|
|
local sep_pos = string.find(inputstr, sep)
|
|
if not sep_pos then
|
|
return inputstr, nil
|
|
end
|
|
local first = string.sub(inputstr, 1, sep_pos - 1)
|
|
local rest = string.sub(inputstr, sep_pos + 1)
|
|
return first, rest
|
|
end
|
|
|
|
local function update_groups()
|
|
debug_print("Updating groups based of tags.")
|
|
end
|
|
|
|
local function setOVR(channel, argument)
|
|
if type(tonumber(argument)) == "number" then
|
|
Cmd('SelectFixture Group '..argument)
|
|
Cmd('Store Group "CASP_OVR Channel '..channel..'" /Overwrite')
|
|
Cmd("ClearSelection")
|
|
debug_print("NUM: Updated CASP_OVR Channel "..channel.." to Group "..argument)
|
|
elseif type(argument) == "string" then
|
|
Cmd('SelectFixture Group "'..argument..'"')
|
|
Cmd('Store Group "CASP_OVR Channel '..channel..'" /Overwrite')
|
|
Cmd("ClearSelection")
|
|
debug_print("STR: Updated CASP_OVR Channel "..channel.." to Group "..argument)
|
|
end
|
|
end
|
|
|
|
local function clearAllOVR()
|
|
for channel = 1, 5/1, 1 do
|
|
Cmd('SelectFixture Group "CASP_OVR Channel '..channel..'"')
|
|
Cmd('Store Group "CASP_OVR Channel '..channel..'" /Remove')
|
|
Cmd("ClearSelection")
|
|
end
|
|
end
|
|
|
|
local function clearOVR(channel)
|
|
Cmd('SelectFixture Group "CASP_OVR Channel '..channel..'"')
|
|
Cmd('Store Group "CASP_OVR Channel '..channel..'" /Remove')
|
|
Cmd("ClearSelection")
|
|
end
|
|
|
|
local function main(display_handle, args)
|
|
if args then
|
|
if string.match(args, ";") then
|
|
local operator, argument = split_first(args, ";")
|
|
if operator == "setOVRC1" then
|
|
setOVR(1, argument)
|
|
elseif operator == "setOVRC2" then
|
|
setOVR(2, argument)
|
|
elseif operator == "setOVRC3" then
|
|
setOVR(3, argument)
|
|
elseif operator == "setOVRC4" then
|
|
setOVR(4, argument)
|
|
elseif operator == "setOVRC5" then
|
|
setOVR(5, argument)
|
|
elseif operator == "clearOVR" then
|
|
clearOVR(argument)
|
|
end
|
|
else
|
|
local operator = tostring(args)
|
|
if operator == "clearAllOVR" then
|
|
clearAllOVR()
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
return main |