Thread Tools Display Modes
Prev Previous Post   Next Post Next
04/09/14, 05:50 AM   #1
belialamiee
Join Date: Apr 2014
Posts: 2
Post ESO event registration

Hi Guys,

I am struggling with something that is probably fundamentally easy.

I have written a quick addon that prints xp to screen. at present it is triggering on update. obviously this is not optimal. So i want it to only update on xp gain.

But I can't seem to get the event to actually work.

here is my current code.

Code:
local curXP = GetUnitXP("Player")
local maxXP = GetUnitXPMax("Player")


function OnUpdate()
    MahaliaXpgain:SetText(string.format("XP: %d/%d", curXP, maxXP))

end

function UpdateXP()
curXP = GetUnitXP("Player")
maxXP = GetUnitXPMax("Player")
OnUpdate()
end

--this was bastardised from yout tutorial at http://wiki.esoui.com/AddOn_Quick_Questions#How_do_events_work.3F
function Mahalia_OnInitialized(self)
    --Register on the top level control...
    self:RegisterForEvent(EVENT_EXPERIENCE_GAINED, UpdateXP)
 
    --OR, register with a string unique to your add-on
    EVENT_MANAGER:RegisterForEvent("Mahalia", EVENT_EXPERIENCE_GAINED, UpdateXP)
end
I can have it trigger by using
Code:
<OnMouseDown>
                UpdateXP()
 </OnMouseDown>
But I can't just seem to get the event to trigger UpdateXP() even when it is was just d("print me") it woudn't trigger on xpgain

What am i doing wrong with event registration?
  Reply With Quote
 

ESOUI » AddOns » AddOn Help/Support » ESO event registration


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off