Thread Rating:
  • 16 Vote(s) - 2.38 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Minion GUI Lua examples
#1
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)
Reply
 


Messages In This Thread
Minion GUI Lua examples - by Underwhelp - 05-05-2016, 07:03 PM
RE: Minion GUI Lua examples - by xlpbodily - 05-05-2016, 10:53 PM
RE: Minion GUI Lua examples - by Ace - 05-07-2016, 01:19 AM
RE: Minion GUI Lua examples - by Underwhelp - 05-14-2016, 08:52 PM

Forum Jump:


Users browsing this thread: 2 Guest(s)

We help you win the game.

FFXIV Bot and More.

 

Products