MMOMinion
Minion GUI Lua examples - Printable Version

+- MMOMinion (https://www.mmominion.com)
+-- Forum: FFXIVMinion (https://www.mmominion.com/forumdisplay.php?fid=87)
+--- Forum: [DOWNLOADS] Addons, Lua Modules, Navigation Meshes.. (https://www.mmominion.com/forumdisplay.php?fid=90)
+---- Forum: I Need Help with LUA coding! (https://www.mmominion.com/forumdisplay.php?fid=104)
+---- Thread: Minion GUI Lua examples (/showthread.php?tid=16372)



Minion GUI Lua examples - Underwhelp - 05-05-2016

Is there any way for me to see the lua code for the Minion button on the new gui? I am referencing the C++ source, for the example test window, yet I am unsure how to code some of the functions syntax in Lua. For example the image button with all window variables removed?

Just messing around to set up my own GUI where I can set it to quickly do or see the functions I need access to. I can see this having all kinds of neat UI widgets, be made up.




Code:
-- My Widget testing   v.00.001:

--Show Test window IMGUI samples
ml_gui.showtestwindow = true

my_gui = inheritsFrom(ml_task)

my_gui = {}
my_gui = inheritsFrom(ml_task)
my_gui.open = true
my_gui.visible = true
my_gui.toggle = true
my_gui.hue = 125
my_gui.mainclick = true
my_gui.botstatus = true
my_gui.selected_mode = "-1"
my_gui.botmodes = ffxivminion.modes
my_gui.botmodesString = ffxivminion.Strings.BotModes()
my_gui.minionmode = {
                        "Assist","Crafting","Duty","Fish","Gather","Grind","Hunt","Hunting Log","MiniGames","NavTest","Party-Grind","Quest","QuickStart",}


--            
function my_gui.Create()
   local newinst = inheritsFrom(my_gui)
   
   --ml_task members
   newinst.valid = true
   newinst.completed = false
   newinst.subtask = nil
   newinst.auxiliary = false
   newinst.process_elements = {}
   newinst.overwatch_elements = {}
     
   newinst.name = "LT_MY_GUI"
   newinst.targetid = 0
    newinst.movementDelay = 0
   
   return newinst
end

function my_gui.Draw( event, ticks )     

    if ( my_gui.open ) then
        
        GUI:SetNextWindowSize(100,60,GUI.SetCond_FirstUseEver) -- set the next window size, only on first ever, GUI.SetCond_FirstUseEver is one of many possible enums.
        
        my_gui.visible, my_gui.open = GUI:Begin("GUI Test##1", my_gui.open)
       
        if ( my_gui.visible ) then                         
--*************************************************************************************************************************************
-- Drop down Title
--*************************************************************************************************************************************            --GUI:CollapsingHeader("Quick Mode Links")
        --Go with menustyle vs? pop
--*************************************************************************************************************************************
-- Display Current Mode
--*************************************************************************************************************************************                
            GUI:Separator()
            my_gui.botmode1 = GUI:Text("Current Bot Mode =")
            GUI:SameLine()
            my_gui.botmode = GUI:TextColored(255,0,0,200,string.pad(gBotMode,20))
            GUI:Separator()            
            
--*************************************************************************************************************************************
--Change Mode Buttons
--*************************************************************************************************************************************    
            --Mode Toggles
            if (GUI:Button("Assist",50,20)) then
                ffxivminion.SwitchMode("Assist")
            end
            
            GUI:SameLine(65)
            
            if (GUI:Button("Quest",50,20)) then
                ffxivminion.SwitchMode("Quest")
            end
            
            --Image Button for gBotRunning status / toggle        
            if ( gBotRunning == "1") then
                GUI:ImageButton("Minion","C:\\Minion\\LuaMods\\my_gui\\run.png",50,50)
                else
                GUI:ImageButton("Minion","C:\\Minion\\LuaMods\\my_gui\\stop.png",50,50)
            end    
            if (GUI:IsItemHovered()) then
                GUI:SetTooltip("Toggle Minion ON/OFF")
            end    
            my_gui.run = gBotRunning
            
            if (GUI:IsItemActive() and GUI:IsMouseClicked(0)) then -- Turn Bot ON/OFF via Image Click
                
                if ( my_gui.run == "1" ) then
                    gBotRunning = "0"
                end
                
                if ( my_gui.run == "0") then
                    gBotRunning = "1"
                end
            end    
    
--*************************************************************************************************************************************
--TESTING AERA - Need to learn to Pull data from bot vs pre defined....
--*************************************************************************************************************************************    
--[[]      GUI:TextWrapped(ffxivminion.Strings.BotModes())
            
            if (GUI:Button("Minion TEST")) then
               GUI:OpenPopup("MinBotTest")
                GUI:SameLine()
                --GUI:Text(my_gui.mode(selected_mode))
            end    
                                
                        
           if (GUI:BeginPopup("MinBotTest")) then
                
                GUI:Separator()
                GUI:Text("Bot Modes")
               GUI:Separator()
                GUI:TextColored(255,0,0,200,string.pad(gBotMode,20))
                GUI:Separator()
                            
                for i,entry in pairs(my_gui.botmodes) do
                    if (GUI:Selectable(my_gui.botmodes[i],false)) then
                        my_gui.selected_mode = my_gui.botmodes[i]
                        ffxivminion.SwitchMode(my_gui.selected_mode)
                    end
                end
                            
                GUI:EndPopup()
                    
            end    
                
    --]]               
    
            if (GUI:Button("Mount")) then
               Mount()
            end    
--*************************************************************************************************************************************
--Pop Up Bot Mode Selections
--*************************************************************************************************************************************    
           
            if (GUI:Button("Minion Mode..")) then
               GUI:OpenPopup("BotMode")
                GUI:SameLine()
                --GUI:Text(my_gui.mode(selected_mode))
            end    
                        
                        
           if (GUI:BeginPopup("BotMode")) then
                
                GUI:Separator()
                GUI:Text("Bot Modes")
               GUI:Separator()
                GUI:TextColored(255,0,0,200,string.pad(gBotMode,20))
                GUI:Separator()
                            
                for i,e in pairs(my_gui.minionmode) do
                    if (GUI:Selectable(my_gui.minionmode[i],false)) then
                        my_gui.selected_mode = my_gui.minionmode[i]
                        ffxivminion.SwitchMode(my_gui.selected_mode)
                    end
                end
                            
                GUI:EndPopup()
                    
            end    
                
            
--*************************************************************************************************************************************
--End of My Main GUI
--*************************************************************************************************************************************
            GUI:Separator()                    
        end
        GUI:End()  -- THIS IS IMPORTANT! For EVERY BEGIN() you NEED to ALWAYS call END(), it does not matter if the window is visible/open or not! Same goes with BeginChild() & EndChild() and others !
      end    
end

function my_gui.HandleButtons( Event, Button )    
    if ( Event == "GUI.Item" ) then
        if (string.find(Button,"my_gui%.")) then
            ExecuteFunction(Button)
        end
    end
end

RegisterEventHandler("Gameloop.Draw", my_gui.Draw)
--RegisterEventHandler("Gameloop.Update", my_gui.OnUpdateHandler)
--RegisterEventHandler("GUI.Update",my_gui.GUIVarUpdate)
RegisterEventHandler("GUI.Item", my_gui.HandleButtons)



RE: Minion GUI Lua examples - xlpbodily - 05-05-2016

Bah you beat me to it.... working on it also though


RE: Minion GUI Lua examples - Ace - 05-07-2016

http://wiki.mmominion.com/doku.php?id=minionlib#gui_api_functions

What specific parts of that code are you interested in?


RE: Minion GUI Lua examples - Underwhelp - 05-14-2016

I originally wanted to see how the window flags are to be properly set, to mimic a boarder-less button, such as the Minion one. I had been using that link, as well as trying to convert the C++ source code examples to LUA. I ended up just contacting a buddy who codes with IMGUI in his own applications to assist me and have since figured it out for the most part, as well as some other neat things you can do.


Took awhile to understand the syntax conversions from C++, as I am a poor coder. I must say that I do like this new GUI, as I have been able to basically replace most all of the exiting GUI functions I normally access, as well as some other neat popups functions. Have been away for work for awhile, but I was still getting some weird graphical glitches sometimes when I hide the main original minion UI, which I have always had occur randomly, even prior to IMGUI.

Yet have not had a chance to play with in for the past week or so.