Hey,
I am new to lua and haven´t found a way to create a popup Settings window,
were you can choose from 2 options and they each execute another Plugin.
If somebody could help me a little bit, I would be so thankfull!
Greetings Doubletap
Hey,
I am new to lua and haven´t found a way to create a popup Settings window,
were you can choose from 2 options and they each execute another Plugin.
If somebody could help me a little bit, I would be so thankfull!
Greetings Doubletap
Something like this:
local function Main(display_handle,argument) -- we need this display_handle
-- ...
local question = "What do you like on your pizza?"
local toppings = {"Pineapple", "Pepperoni", "Mushroom"}
local choice = PopupInput(question, display_handle, toppings);
Echo( "You choose : %d", choice ) -- You choose : 0
Thank you so much!!!!!
Ok one more question, my menu is now working and I tryed the following to get a function to the menupoints:
local function Main(display_handle,argument)
local question1 = "Select Menu Point"
local mepoints = {"Test0", "Test1", "Test2"}
local choice1 = PopupInput(question1, display_handle, mepoints);
Echo( "You choose : %d", choice1 ) -- Output: You choose : 0
if choice1 == 0 then
Cmd "Clear"
end
if choise1 == 1 then
Cmd "Cleara"
end
if choise1 == 2 then
Cmd "Channel"
end
end
Display More
Close, Cmd is a function so it needs zero or more parameters in parentheses.
local undo
local color = {0,0,0}
if choice == 0 then
undo = CreateUndo("Removing Pineapple")
color = {100,100,0}
elseif choice == 1 then
undo = CreateUndo("Removing Pepperoni")
color = {100,0,0}
elseif choice == 2 then
undo = CreateUndo("Removing Mushroom")
color = {100,100,100}
end
Cmd("Fixture " .. choice + 1 .. " At Full", undo) -- undo is optional
Cmd("Attribute ColorRGB_R at " .. color[1], undo)
Cmd("Attribute ColorRGB_G at " .. color[2], undo)
Cmd("Attribute ColorRGB_B at " .. color[3], undo)
Cmd("Store Preset 21.1 /O /NC", undo)
Cmd("ClearAll", undo)
CloseUndo(undo)
Display More
Undo is just here for example, though for some reason it doesn't work exactly the way I would have expected, still learning myself.
But you´re pretty good and help me a lot!!! Now I tryed to put a Menu inside a Menu. But gMA 3 dosen´t like it.
function Startmsg()
Echo ("===== Menu Started =====")
end
-- Plugin löscht Items, deswegen Abfrage ob sicher
local function Areyousure(display_handle)
local question2 = "This Plugin"
local janein = {"OK", "Cancel"}
local choice2 = PopupInput(question2, display_handle, janein);
Echo( "You choose : %d", choice2 ) -- Output: You choose : 0
if choice2 == 0 then
appbuilder()
elseif choice2 == 1 then
Cmd "ESC"
end
end
-- Diplay Menu
Startmsg()
local function Main(display_handle)
-- Wir brauchen umbedingt das display_handle!!!
local question1 = "Select Menu Point"
local mepoints = {"Test Menu in Menu", "Clear", "ClearAll"}
local choice1 = PopupInput(question1, display_handle, mepoints);
-- Abfrage
if choice1 == 0 then
Areyousure()
elseif choice1 == 1 then
Cmd "Clear"
elseif choice1 == 2 then
Cmd "Cleara"
end
end
return Menu
Display More
when I execute this, the following Error appears, you know why?
MainTask 14m39.683s : ===== Menu Started =====
MainTask 14m40.953s : OK:Call Plugin 2
LUA 14m42.072s : LUA API Syntax error at :22
LUA 14m42.072s : PopupInput ( [string:title],UIcaller:lightuserdata,table:{{'str'|'int'|'lua'|'handle', name, type-dependent}...}[,string:selectedValue[,integer:x,integer:y]] ) returns string:value
The reason looks like it's because display_handle is local to Main but you arent passing it to areyousure(). try changing the above line 36 to Areyousure(display_handle)
Bro I love you Thank you soooooo muuuuuch!!!!!
Is there a way to contact you, if I need some more help in just lua coding?
I look at the forums most days. I also have a bit of code posted on GitHub that might be helpful for educational purposes.
Ok Thanks!
Is there a way to import pictures inside a display_handle, just to let it look better?
Just guessing here but i believe the display handle is just a reference to what physical display needs to handle the dialog.
Ok, so you can´t think of a way to import an image into the created menu
Don’t have an account yet? Register yourself now and be a part of our community!