Hello, I'm a LUA beginner. I wrote my first addon using the wowwiki guide
http://www.wowwiki.com/AddOn_program...l/Introduction
It worked perfectly, printing "hello" when i log into my wow account. I then tried to modify the code in order to add a message when I select a new target in game.
The lua program became:
Code:
local function Test_OnEvent(self, event, ...)
if (event == "PLAYER_TARGET_CHANGED") then
print("TARGET CHANGED")
end
end
function Frame1_OnLoad()
print("hello")
Frame1:RegisterEvent("PLAYER_TARGET_CHANGED")
Frame1:SetScript("OnEvent", Test_OnEvent)
end
with a xml file like that:
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="Frame.lua"/>
<Frame name="Frame1">
<Scripts>
<OnLoad>
Frame1_OnLoad();
</OnLoad>
</Scripts>
</Frame>
</Ui>
Now, when I enter wow, nothing happens, hello is no more displayed. I tried many things (such as adding OnEvent lines in the xml file) but still still the same problem.
Can someone tell me please what I'm doing wrong ? Thanks !