These first people of questions might sound stupid to people but please bare with me here... Can someone please point out why this doesn't work? Obviously I'm doing it wrong but still trying to learn.
Appreciate any help in advance... I'm very keen to learn.
Please be specific when correcting me, I'll learn quicker if I know why things don't work.
Code:
-- Create a new table for our code:
mymodule= { }
-- Some local variables we use in our module:
mymodule.running = false
mymodule.lastticks = 0
-- Initializing function, we create a new Window for our module that has 1 button and 1 field to display data:
function mymodule.ModuleInit()
GUI_NewWindow("mymodule",350,50,250,250);
GUI_NewButton("mymodule","Start/Stop Invite","MYMODULE.TOGGLE");
local el = EntityList("chartype=4", "maxdistance=50", "minlevel=30")
if ( el ) then
local i,e = next(el)
while (i~=nil and e~=nil) do
//Somehow invite code goes here?
local i,e = next(el,i)
end
end
end
-- The function that gets called when the button is pressed:
function mymodule.ToggleRun()
mymodule.running = not mymodule.running
end
-- The Mainloop function, gets called all the time by FFXIVMinion:
function mymodule.OnUpdateHandler( Event, ticks )
if ( mymodule.running and ticks - mymodule.lastticks > 500 ) then
mymodule.lastticks = ticks
-- if the player is alive, set the current HP value into the new field of our created Window:
if (Player.alive) then
hpvalue = tostring(Player.health.current)
end
end
end
-- Registering the Events
RegisterEventHandler("Gameloop.Update",mymodule.OnUpdateHandler) -- the normal pulse from the gameloop
RegisterEventHandler("MYMODULE.TOGGLE", mymodule.ToggleRun) -- the function that gets called when our button is pressed
RegisterEventHandler("Module.Initalize",mymodule.ModuleInit) -- the initialization function, gets called only once at startup of the game
Appreciate any help in advance... I'm very keen to learn.
Please be specific when correcting me, I'll learn quicker if I know why things don't work.