Thread Rating:
  • 9 Vote(s) - 3.56 Average
  • 1
  • 2
  • 3
  • 4
  • 5
crash on setting change
#1
I'm really new to LUA... I try to make a Summon module for Summoner, and took some other code and try to wrap my head around ;)

I have this, but as soon as I try to change the ID setting in the GUI, the game crashes... what am I missing?

Code:
-- Create a new table for our code:
Summon= { }
-- Some local variables we use in our module:
Summon.running = false
Summon.lastticks = 0

function Summon.ModuleInit()
    if (Settings.Summon.SumEnabled == nil) then
        Settings.Summon.SumEnabled = "0"
    end
    GUI_NewWindow("Summon",50,50,100,50)
    GUI_NewCheckbox("Summon","Enabled","SumEnabled", "Main")
    GUI_NewNumeric("Summon","ID:","idvalue","Options")
    GUI_SizeWindow("Summon",150,120)
    SumEnabled = Settings.Summon.SumEnabled
    idvalue = Settings.Summon.idvalue
end

function Summon.GUIVarUpdate(Event, NewVals, OldVals)
    for k,v in pairs(NewVals) do
        if (     k == "SumEnabled" or
                k == "idvalue")
        then
            Settings.Summon[tostring(k)] = v
        end
    end
    GUI_RefreshWindow("Summon")
end

function Summon.OnUpdateHandler( Event, ticks )
    if ( SumEnabled == "1" and ticks - Summon.lastticks > 500 ) then
        Summon.lastticks = ticks
        
        if ( Player:IsMoving() == false) then
            local mypet = Player.pet
            --if ( TableSize(mypet) == 0) then
                --local action = ActionList:Get(idvalue)
                --if ( action ) then
                --    d("ID: ".. tostring(action.id))
                --end
            --end
        end
    end
end
            
RegisterEventHandler("Module.Initalize",Summon.ModuleInit)
RegisterEventHandler("GUI.Update",Summon.GUIVarUpdate)
RegisterEventHandler("Gameloop.Update",Summon.OnUpdateHandler)

and: is there a way to test code outside the game? It really takes time to change a bit, then start the game over and over again ;)

Edit: got it, seems the Settings file was corrupt...
Reply
 


Messages In This Thread
crash on setting change - by TauTau - 10-29-2013, 07:18 PM

Forum Jump:


Users browsing this thread: 2 Guest(s)

We help you win the game.

FFXIV Bot and More.

 

Products