Using what I can find in the wiki, I'm trying to create an addon that puts a message in the chatbox every time a character gains XP. I'm not proficient with Lua or XML but I've programmed for four years now and can muddle my through the wiki. I think I have a proper(though crude) addon, but it doesn't work at all. I looked at some code for other addons and I think I'm doing it right but the lack of tutorials and documentation make it hard to me to find out what I'm doing wrong on my own.
I'd also like to know if there's a way to get console output for addons or access to a debugger. If I could have error returned or be able to view my addon as it runs it would be very helpful
Lua Code:
local function OnXPGain(eventCode, gain, reason)
--print xp to chat
d( "XP Gained: " .. gain )
end
function OnLoad()
EVENT_MANAGER:RegisterForEvent(EVENT_EXPERIENCE_GAIN, OnXPGain)
d( "loaded" )
end
Code:
<GuiXml>
<Controls>
<TopLevelControl name="XPTracker">
-<OnInitialized>
OnLoad()
</OnInitialized>
</TopLevelControl>
</Controls>
</GuiXml>