Hi There,
I would like to combine two scripts I have modified. Both work individualy but when combined they stop working. Noob allert. Might be somthing very simple?
So, I managed to modify an existing lua script to my liking. The script enables a user to select a fixture type (set a variable) using a popup. The script prints these in the system monitor so I know the variables are indeed defined.
This is the script:
local fixture_input = 0
function Main(display_handle)
-- Select Fixture Type
local Fixture_input = PopupInput({title="Fixture Type", caller=display_handle, items={"Spot","Beam","Wash","Led_1","Led_2","Strobe","Blinder","CANCEL"}})
if Fixture_input == 0 then
Fixture_type = "Spot"
Printf(""..Fixture_type.."")
elseif Fixture_input == 1 then
Fixture_type = "Beam"
Printf(""..Fixture_type.."")
elseif Fixture_input == 2 then
Fixture_type = "Wash"
Printf(""..Fixture_type.."")
elseif Fixture_input == 3 then
Fixture_type = "Led_1"
Printf(""..Fixture_type.."")
elseif Fixture_input == 4 then
Fixture_type = "Led_2"
Printf(""..Fixture_type.."")
elseif Fixture_input == 5 then
Fixture_type = "Strobe"
Printf(""..Fixture_type.."")
elseif Fixture_input == 6 then
Fixture_type = "Blinder"
Printf(""..Fixture_type.."")
elseif Fixture_input == 7 then
Printf("Plugin execution is Canseled")
return Main
end
end
return Main
I also managed to modify an existing scipt to enable me to write some sequences and assign a group, preset and matricks pool item to a recipe in a cue part. I would like to use the variable "Fixture_type" which I have set in the previous mentioned popup script in the script I use to store the sequences. Both scripts work when put in a plugin individualy but if I combine the two in one plugin both stop working.
Here is the script that writes the sequences:
local startsequence = 1
--Here I test if the variable "fixture_type" is working. It is. I remove this when combining the two scripts off-course.
local Fixture_type = "Blinder"
--Variables list Sequence name
local sequence_name = {
""..Fixture_type.."_Sym_1/2_Block",
""..Fixture_type.."_Sym_2/2_Block",
""..Fixture_type.."_Sym_1/2_2Fix",
""..Fixture_type.."_Sym_1/2_2Fix",
}
--Variables list Matricks pool items
local matricks_4fixtures_name = {
"1Fix_1/2_Sym",
"2Fix_1/2_Sym",
"3Fix_1/2_Sym",
"4Fix_1/2_Sym",
}
function main()
Echo("This is a test message")
--loop
for i=1, 4 do
--commands , store sequence
Cmd("Store sequence " ..i.." /o")
--store cue and cue parts
Cmd("Store sequence "..i.." cue 1 part 4 /o")
Cmd("Store sequence "..i.." cue 1 part 8 /o")
Cmd("Store sequence "..i.." cue 1 part 12 /o")
Cmd("Store sequence "..i.." cue 1 part 16 /o")
--assign, group preset and matricks group of 4 fixtures
Cmd("Assign group "..Fixture_type.."_4 at sequence "..i.." cue 1 Part 4.1/o")
Cmd("Assign preset 21."..Fixture_type.."_FG_Bump at sequence "..i.." cue 1 Part 4.1/o")
Cmd("Assign Matricks "..matricks_4fixtures_name[i].." at sequence "..i.." cue 1 Part 4.1/o")
--assign, group preset and matricks group of 8 fixtures
Cmd("Assign group "..Fixture_type.."_8 at sequence "..i.." cue 1 Part 8.1/o")
Cmd("Assign preset 21."..Fixture_type.."_FG_Bump at sequence "..i.." cue 1 Part 8.1/o")
Cmd("Assign Matricks 2Fix_1/2_Sym at sequence "..i.." cue 1 Part 8.1/o")
--assign, group preset and matricks group of 12 fixtures
Cmd("Assign group "..Fixture_type.."_12 at sequence "..i.." cue 1 Part 12.1/o")
Cmd("Assign preset 21."..Fixture_type.."_FG_Bump at sequence "..i.." cue 1 Part 12.1/o")
Cmd("Assign Matricks 3Fix_1/2_Sym at sequence "..i.." cue 1 Part 12.1/o")
--assign, group preset and matricks group of 16 fixtures
Cmd("Assign group "..Fixture_type.."_16 at sequence "..i.." cue 1 Part 16.1/o")
Cmd("Assign preset 21."..Fixture_type.."_FG_Bump at sequence "..i.." cue 1 Part 16.1/o")
Cmd("Assign Matricks 4Fix_1/2_Sym at sequence "..i.." cue 1 Part 16.1/o")
Cmd("Label sequence "..i.." "..sequence_name[i].."")
end
end
return main
My question is: how can I combine the two scripts? I want to be able to use the variable I defined in the first popup script and use this in the second script in which I write the seq's.
Hope you can help. Please be kind. This is my first week into Lua. 