Thread Tools Display Modes
Prev Previous Post   Next Post Next
08-15-10, 05:28 PM   #1
Waky
A Cobalt Mageweaver
 
Waky's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2010
Posts: 200
Help with COMBAT_LOG_EVENT_UNFILTERED

I'm trying to create an addon that will be able to tell you when you cast Focus Magic on someone.

This is my XML (<Scripts>...</Scripts>):
Code:
		<Scripts>
			<OnLoad>
				wFM_OnLoad();
			</OnLoad>
			<OnEvent>
				wFM_OnEvent(event, ...);
			</OnEvent>
			<OnMouseDown>
				wFM_OnMouseDown();
			</OnMouseDown>
			<OnMouseUp>
				wFM_OnMouseUp();
			</OnMouseUp>
		</Scripts>
This is my OnLoad that's referred to in XML, as you can see my wFM_MainFrame is set to Register the combat log event.
Code:
function wFM_OnLoad()

	wFM_MainFrame:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED");
	
	return;
end --OnLoad
and finally this is my OnEvent:
Code:
function wFM_OnEvent(event, ...)
  local timestamp, type, sourceGUID, sourceName, sourceFlags, destGUID, destName, destFlags, spellId, spellName = select(1, ...)
  
   if event == "COMBAT_LOG_EVENT_UNFILTERED" and type == "SPELL_CAST_SUCCESS" then
		if spellId == 54646 then
			DEFAULT_CHAT_FRAME:AddMessage(""..sourceName.." has cast Focus magic");
		end
	end
end --OnEvent
Basically when I cast Focus Magic it should say "Waky has cast Focus Magic" in my chat frame, but it keeps returning sourceName as nil.

Can anyone tell me what's wrong with this code?

Any help would be appreciated, this is my first attempt at an AddOn (besides Hello World! :P)
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » Help with COMBAT_LOG_EVENT_UNFILTERED


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