Thread Tools Display Modes
04-28-06, 11:40 PM   #1
Barthlbey
A Kobold Labourer
Join Date: Apr 2006
Posts: 1
Event monitor

Hi ,

I'm actually working on a boss mod for my guild but I'm having some problem triggering function base on event. My main problem is I don't know exactly what are the argument on the event. My question, , well I'd like to know If I could do a simple code to show me the argument of certain event on my chatbox.

Exemple : Monitoring all CHAT_MSG_SPELL_CREATURE_VS_CREATURE_BUFF on the encounter or any other event I'd like to monitor .

Thanks for you attention.

Barthlbey
  Reply With Quote
04-30-06, 05:34 PM   #2
Gello
A Molten Giant
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 521
Print out the arguments in the event using DEFAULT_CHAT_FRAME:AddMessage:

Code:
function MyMod_OnEvent()
  if event=="CHAT_MSG_SPELL_CREATURE_VS_CREATURE_BUFF" then
    DEFAULT_CHAT_FRAME:AddMessage("__ event __")
    DEFAULT_CHAT_FRAME:AddMessage("arg1 = "..tostring(arg1))
    DEFAULT_CHAT_FRAME:AddMessage("arg2 = "..tostring(arg3))
    DEFAULT_CHAT_FRAME:AddMessage("arg3 = "..tostring(arg3))
  end
end
You hit A Mob for 100.
A Mob gains Renew.
__ CHAT_MSG_SPELL_CREATURE_VS_CREATURE_BUFF __
arg1 = A Mob gains Renew.
arg2 = nil (probably, untested)
arg3 = nil
You hit A Mob for 150.
etc

Small aside, but everyone learning (and most of those who feel they have already learned) should be in the practice of tossing in a debug print in the OnEvent handler in its formative stages to see how often events fire.

I see a lot of mods blindly registering for events and registering for redundant events (ie, ITEM_LOCK_CHANGED and BAG_UPDATE) or missing an event (ie, CHAT_MSG_EMOTE and CHAT_MSG_TEXT_EMOTE) that a debug print should make clear. (and in the case of ITEM_LOCK_CHANGED and BAG_UPDATE it will hopefully terrorize them from having the two always registered)
  Reply With Quote
05-01-06, 01:38 PM   #3
Iriel
Super Moderator
WoWInterface Super Mod
Featured
Join Date: Jun 2005
Posts: 578
I'll note that the newer version of DevTools have a /dtchatevent feature which puts a subtle [#] link in front of every line in your chat log which you can click to popup the event name and args that caused it (or at least, that was active while the message was shown)

In an upcoming release you'll be able to ask to be notified about arbitrary events, also.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Event monitor


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