Hi,
I making my first UI mod and as part of it i'm trying to grab when a spell is casting and when a spell has been cast. I've had a look around the net and on wiki and here and found it very helpful but i'm hitting a bit of a block atm.
heres what I have as a test case.
Code:
SpellTracker = { }
SpellTracker = CreateFrame("Frame", nil, UIParent)
SpellTracker:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED")
SpellTracker:SetScript("OnEvent", function(_,e) SpellTracker.[e]() end)
function UpdateFunction(self)
local spell, _, displayName, _, _, endTime = UnitCastingInfo("player")
if spell then
--message(spell)
message(displayName)
end
end
function SpellTracker.UNIT_SPELLCAST_SUCCEEDED(unit, spell, rank)
message(spell)
if unit ~= "player" then
return
end
message(spell)
end
I am new to Lua so that may be most of the problem :P Currently a message box pops up nicely when I go to cast a spell. Another box also appears when 'message(spell)' is called after the spell has succesfully cast, however, its empty. 'Player' also seems to be empty and as such the if statement fails as well.
What am I missing/not understanding here? All i'm after is 'spell' which I believe is the second argument of 'UNIT_SPELLCAST_SUCCEEDED' according to wowwiki.
Regards
Scythe