Thread Tools Display Modes
05-01-08, 09:57 AM   #1
scythe3000
A Defias Bandit
Join Date: May 2008
Posts: 1
Post Some basic Spell capturing Help

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

Last edited by scythe3000 : 05-01-08 at 09:59 AM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Some basic Spell capturing Help


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