1. Hi I'm a newbie addon developer and I'm running into some trouble understanding the SPELL_CAST_SUCCESS event. I wrote a short block of code that is supposed to detect when a specific spell is casted and then trigger a cooldown frame I set up. However, the event only triggers when the spell casted is an instant cast spell such as Corruption or Drain Soul. When I successfully cast a casted spell like Haunt or Shadow Bolt, the event doesn't trigger.

    Can someone help me understand why SPELL_CAST_SUCCESS doesn't work for casted spells and what event I should be using instead?

    Here is my code for reference:

     function DispelBar_OnEvent(event,...)  
        local timeStamp, event, hideCaster, sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, destRaidFlags = select(1,...)
        if(event=="SPELL_CAST_SUCCESS") then
            local spellName = select(13,...)
            print("SPELL_CAST_SUCCESS"..": "..spellName)
            if(spellName == "Haunt") then
                CooldownFrame:SetCooldown(GetTime(), 10)

    In this example if I changed if(spellName == "Haunt") to an instant cast spell like if(spellName == "Corruption") then it works.

    Thanks for all help in advance and let me know if I need to clarify anything.

    That event just isn't used for those sorts of spells.

    Run /eventtrace

    Cast a spell (do this all in a zone without lots of people, or you'll get lots of events). See what events fire, then use those =)

    Thanks a lot for the etrace command, I didn't know it existed! With it I found UNIT_SPELLCAST_SUCCEEDED which seems to do the job thank you.

    From looking at the documentation, I couldn't tell that SPELL_CAST_SUCCEEDED was the wrong event to use, how would I be able to discern this in the future?

    Run /eventtrace, just like you did there. That'll show you the actual events that are happening.

    Online references and howtos can help, but Blizzard does change things fairly often, and when they do, it takes a while for everyone's docs to catch up... not to mention that some sites don't get updated very often, so things you find around the 'net may be referring to older versions of the game without saying so.

    I discuss this in the second edition of the book. Events change constantly, when and what they fire for. Any attempt to truly document them is infeasible.

    You're confusing two types of events here.

    One is the event which is passed to OnEvent, which you register for with RegisterEvent etc. UNIT_SPELLCAST_SUCCEEDED is one of those.

    The other one is arg2 to the COMBAT_LOG_EVENT and COMBAT_LOG_EVENT_UNFILTERED events, incidentally also called "event" by some docs, when really it should be subEvent or something along these lines. This one indicates the type of combat log entry - SPELL_CAST_SUCCESS is one of these.