Trying to learn how to write scripts for mmominion, and I am having trouble interacting with the ui
the values and behaviour is correct when i am looking at the console, but the ui never updates, what am I doing wrong?
Code:
fiveminqq={ }
-- module settings
fiveminqq.mainwindow = { name="5minqq", x=550, y=100, w=200, h=280 }
fiveminqq.tickRate = 2000
-- init & ui
function fiveminqq.ModuleInit()
GUI_NewWindow(fiveminqq.mainwindow.name,fiveminqq.mainwindow.x,fiveminqq.mainwindow.y,fiveminqq.mainwindow.w,fiveminqq.mainwindow.h)
GUI_NewField(fiveminqq.mainwindow.name,"Target:","fiTargetName")
end
-- main loop
fiveminqq.lastTick = 0
fiveminqq.lastKnownTarget = ""
function fiveminqq.OnUpdateHandler( Event, ticks )
if (ticks - fiveminqq.lastTick > fiveminqq.tickRate) then
fiveminqq.lasttick = ticks
-- monitior target
local mytarget = Player:GetTarget()
if(mytarget) then
if(mytarget.name ~= fiveminqq.lastKnownTarget) then
d("[Last known target: " .. fiveminqq.lastKnownTarget .. "] [New target: " .. mytarget.name .. "]")
fiveminqq.lastKnownTarget = mytarget.name;
fiTargetName = mytarget.name; -- why does this not update the gui field???
end
end
end
end
-- subscriptions
RegisterEventHandler("Module.Initalize",fiveminqq.ModuleInit)
RegisterEventHandler("Gameloop.Update",fiveminqq.OnUpdateHandler)
the values and behaviour is correct when i am looking at the console, but the ui never updates, what am I doing wrong?