WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   General Authoring Discussion (https://www.wowinterface.com/forums/forumdisplay.php?f=20)
-   -   Looking for Help with an Event Detection Issue (https://www.wowinterface.com/forums/showthread.php?t=34224)

DNBRMG 07-28-10 11:53 AM

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"


LCFHeLL 07-28-10 12:18 PM

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

DNBRMG 07-28-10 12:53 PM

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.

lilsparky 07-28-10 01:27 PM

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

DNBRMG 07-29-10 01:18 PM

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.

lilsparky 07-30-10 03:34 PM

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.

Seerah 07-30-10 05:48 PM

It still works that way.


All times are GMT -6. The time now is 06:20 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI