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)