Thread Tools Display Modes
02-04-11, 05:02 AM   #1
JosseWow
A Defias Bandit
Join Date: Feb 2011
Posts: 2
Unhappy Having problem with basic things

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 !
 
02-04-11, 05:16 AM   #2
JosseWow
A Defias Bandit
Join Date: Feb 2011
Posts: 2
Sorry, the code above works. Maybe could an administator delete this post ?
 

WoWInterface » Developer Discussions » Lua/XML Help » Having problem with basic things


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