Thread Tools Display Modes
07-28-10, 11:53 AM   #1
DNBRMG
A Murloc Raider
Join Date: Sep 2008
Posts: 5
Looking for Help with an Event Detection Issue

I am running into a little bit of a problem getting the game to detect when the "SPELL_AURA_APPLIED" event has been triggered for an add-on that I am working on. I am pretty sure that the "SPELL_AURA_APPLIED" event is the correct event as that is how the event is written to the "World of Warcraft\Logs\CombatLog.txt" file when combat logging has been turned on. I am thinking that the problem is either an event detection issue or a chat window settings issue. I am considering changing tactics and switching to a combat log parsing technique even though I would prefer the event hook method. Any though, comments, suggestions, advice would be much appreciated.

The chat windows setting issue is a long shot but it is something I have been looking into owing to the fact that I found out the hard way that guild officer chat is hidden by default with the 3.3.5 Blizzard chat frame changes. Shortly after 3.3.5 was release a few friends and I left the guild we were in to start another guild and as officers in the new guild we weren't seeing the officer chat channel; a quick look through the chat frame options revealed that the guild officer channel was not checked, and therefore not being displayed in the chat frame. So I am thinking that there could be an obscure chat channel that the DEFAULT_CHAT_FRAME:AddMessage() output is being directed to that has been disabled similarly to the guild officer channel.

Code:
--[[
  Sample debugging code.
--]]

local addon = CreateFrame"Frame"
local _G = getfenv(0)

DEFAULT_CHAT_FRAME:AddMessage("debugger")

addon:SetScript("OnEvent", function()
  if(event=="SPELL_AURA_APPLIED") then
    DEFAULT_CHAT_FRAME:AddMessage("event detected")
  end
end)

addon:RegisterEvent"SPELL_AURA_APPLIED"
  Reply With Quote
07-28-10, 12:18 PM   #2
LCFHeLL
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 4
Code:
--[[
  Sample debugging code.
--]]

local addon = CreateFrame"Frame" 

print("debugger")

addon:SetScript("OnEvent", function(self, event, time, subevent)
  if(subevent=="SPELL_AURA_APPLIED") then
    print("event detected")
  end
end)

addon:RegisterEvent"COMBAT_LOG_EVENT_UNFILTERED"
something like this
  Reply With Quote
07-28-10, 12:53 PM   #3
DNBRMG
A Murloc Raider
Join Date: Sep 2008
Posts: 5
Thanks for the advice. I figured it that working with the combat log system was going to be the direction I needed to head. It is also good to know that combat log events can evaluated down to a sub event level.
  Reply With Quote
07-28-10, 01:27 PM   #4
lilsparky
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Oct 2007
Posts: 117
SPELL_AURA_APPLIED is not an event, per se. you need to register COMBAT_LOG_UNFILTERED as your event, and then parse the combat log event's arguments to figure out what type of combat log event occurred. this is how you detect SPELL_AURA_APPLIED.

and, fwiw, this particular combat log event has had some problems in the recent past with not actually registering for proc-oriented auras. not sure it's been fixed. most addons moved to a manual aura check using UnitAura() at strategic times (or ever x seconds).

http://www.wowwiki.com/API_COMBAT_LOG_EVENT
  Reply With Quote
07-29-10, 01:18 PM   #5
DNBRMG
A Murloc Raider
Join Date: Sep 2008
Posts: 5
Thank you for all your help

Thank you for all your help. The WoWWiki article in particular has proven to be most useful. It is my intent to use the UnitAura() API function to identify the spell ID's of specific aura detected on their respective targets. I can also see where I might need to employ the use of combat log event filters in an effort to minimize CPU usage as a quick test of the new and improve event detection code (shown below) in Ironforge had the debugging message popping up every 5 seconds or so. Thanks again for your help.
Code:
local addon = CreateFrame"Frame"

addon:SetScript("OnEvent", function(self, event, _, etype, ...)
  if ( event == "COMBAT_LOG_EVENT_UNFILTERED" and etype == "SPELL_AURA_APPLIED" ) then
    DEFAULT_CHAT_FRAME:AddMessage("aura application detected.")
  end
end)

addon:RegisterEvent"COMBAT_LOG_EVENT_UNFILTERED"
I am a huge fan of zork's Diablo III themed Roth UI. Getting the rFilter2 component of that UI configured is of particular interest to me right now yet finding the right spell ID's to enter into the config section of the lua has been a bit problematic using available resources. Most of the Aura's I am interested in tracking haven been pretty straight forward, while a few have come up with a few possible spell ID's. After having some success at using the UnitAura() function in a "/run" macro I figured it shouldn't be to hard to do the same thing in an addon. And now that I have the event detection working reasonably well I am one step closer to making that a reality.
  Reply With Quote
07-30-10, 03:34 PM   #6
lilsparky
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Oct 2007
Posts: 117
is there some reason your code lacks parentheses around some of your arguments?

local addon = CreateFrame"Frame"

should be

local addon = CreateFrame("Frame")

and:

addon:RegisterEvent"COMBAT_LOG_EVENT_UNFILTERED"

should be:

addon:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")


is this just some quirk of your copy-and-paste technique?


anyway, be aware that there might still be issues with proc-oriented buffs not being detected. not sure if blizzard ever fixed these.
  Reply With Quote
07-30-10, 05:48 PM   #7
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
It still works that way.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » Looking for Help with an Event Detection Issue

Thread Tools
Display Modes

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