Hi,
I've decided to dig deeper into the world of addons for WoW and in that regard I've been looking for resources albeit detailed instructions seem to be somewhat scarce.
I've gotten a nice little window frame created which will suit my need quite well, but in order to really get going I need to register some events, but somehow I can't get them to fire. It's very possible I'm overlooking something which'd be blindingly obvious, but I seem to have stared too long and hard at it.
The setup is pretty simple. I have cut parts for readability but shout out if I have omitted key information.
First, the XML file:
Code:
<Ui xmlns="http://www.blizzard.com/wow/ui/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\..\FrameXML\UI.xsd">
<Script File="HMana.lua"/>
<Frame name="hManaFrame" toplevel="true" parent="UIParent" frameStrata="DIALOG" hidden="false" enableMouse="true" movable="true">
...
<Scripts>
<OnLoad>
hMana_OnLoad();
</OnLoad>
<OnEvent>
hMana_OnEvent();
</OnEvent>
...
And the LUA file, again cutted for readability:
Code:
function hMana_OnLoad()
print("registering event");
hManaFrame:RegisterEvent("PLAYER_ENTERING_WORLD");
hManaFrame:RegisterEvent("PLAYER_TARGET_CHANGED");
hManaFrame:RegisterEvent("LOOT_OPENED");
print("done registering events");
end
...
function hMana_OnEvent()
if (event == "PLAYER_ENTERING_WORLD") then
print("Test. Entered world.");
else
print("Just a test, event fired: " .. event);
end
end
I can with the print's in the OnLoad function tell that it indeed does get called, and supposedly the three events should be bound to the frame which I've defined in the XML file. Am I wrong here?
Right or wrong, it doesn't seem like the OnEvent function ever gets called (some output should appear in the chatframe under any circumstances when the OnEvent function gets executed) and I'm clueless as to why. I'd really love if any of you could correct me me where and if I'm wrong.
Best regards,
Klaus