Thread Tools Display Modes
05-16-07, 10:09 AM   #1
zachwlewis
A Murloc Raider
AddOn Author - Click to view addons
Join Date: May 2007
Posts: 5
Detect vendor window problems

After days of reading, I've decided to work on my first WOW AddOn. I'm trying to create one to prompt the user when she opens a vendor window and the vendor sells a recipe they can learn but do not already know.

As of right now, I've got the NewRecipe.toc, NewRecipe.xml and NewRecipe.lua.

My XML looks something like this:

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="NewRecipe.lua" />

<Frame name="NewRecipe_core">
  <Scripts>
    <OnLoad>
      this:RegisterEvent("VARIABLES_LOADED");
    </OnLoad>
    <OnEvent>
      if(event=="VARIABLES_LOADED")then
        NewRecipe_init();
      elseif(event=="MERCHANT_SHOW")then
        NewRecipe_popup();
      end;
    </OnEvent>
  </Scripts>
</Frame>

</Ui>
My Lua looks something like this:

Code:
function NewRecipe_init()
  SendChatMessage("Loaded.", "SAY");
end;

function NewRecipe_popup()
  SendChatMessage("Popup.", "SAY");
end;
If I call "/console reloadui," I see the message displayed by NewRecipe_init(); however, when I talk to a vendor, the function doesn't fire.

I know that those SendChatMessage functions probably aren't the best thing to use, but I'm just trying to detect an event fire.

Any suggestions?
  Reply With Quote
05-23-07, 10:25 PM   #2
Crepusculu
A Deviate Faerie Dragon
 
Crepusculu's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 16
Your frame "NewRecipe_core" has only been registered to receive the "VARIABLES_LOADED" event. If you want the "MERCHANT_SHOW" event, you need to insert
this:RegisterEvent("MERCHANT_SHOW");


if you want a simple output for testing, I suggest declaring a function such as:
Code:
function Print(x)
	DEFAULT_CHAT_FRAME:AddMessage(x)
end
in your lua code. Then use Print("Message")
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » Detect vendor window problems


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