Intercept Warning Icon - Regardless of Stance

  • 9 posts
    #1 Jun 06, 2011 at 16:39 UTC - 0 likes

    Hey WA developers, first of all a massive thank you for developing this beautiful revamped power auras, I now find myself trying to convert people to it all the time - such a powerful and useful addon! Thanks a bunch.

    I'm trying to figure out how to display a kind of Action Usable warning for Intercept, that will show regardless of stance or rage need. I know this is a rather tricky custom kind of aura, and I have had a good look but only found the solution for overpower. In fact, it would be useful for many spells such as shield wall/spell reflection, recklessness, where you need to be in certain stances and with certain gear equipped in order for the ordinary set of rules to display the warnings.

    I'm not accomplished in .lua although I can sort of understand the code. My main issue is not knowing which variables to use, and thought I might get some guidance from the real gurus out there.

    I know you need a custom trigger and a custom untrigger.

    Something along these lines:

    function(event, _, message, _, _, source, _, _, _, _, spellName)
        if(event == "COMBAT_LOG_EVENT_UNFILTERED_CUSTOM" and UnitIsUnit(source or "", "player") and (message == "SPELL_UPDATE_USABLE") and spellName == "Intercept") then
            WeakAurasTimers:ScheduleTimer(WeakAuras.ScanEvents, 5, "INTERCEPT_END")
            return true


    function(event, _, message, _, _, source, _, _, _, _, _, spellName)
        if(event == "COMBAT_LOG_EVENT_UNFILTERED_CUSTOM") then
            if(message == "SPELL_CAST_SUCCESS" and UnitIsUnit(source or "", "player") and spellName == "Intercept") then
                return true
        elseif(event == "INTERCEPT_END") then
            return true

    I've tried this and I'm not getting any obvious syntax errors so I'm guessing that my approach is incorrect or "SPELL_UPDATE_USABLE" is the wrong variable.

    I'm not sure if I have the wrong number of " _, " in the function header, and to be honest I have no clue what their purpose serve...My programming area is stronger in musical applications such as MaxMsp/SuperCollider....

    Whoever is willing to help will have my everlasting appreciation as it will apply to a whole range of spells.


    #2 Jun 06, 2011 at 18:00 UTC - 0 likes

    Ignoring the rest of the code for now. Are you sure SPELL_UPDATE_USABLE isn't only fired if your "Intercept" can really be used again (eg. rage and stance are correct too)?

    On the other hand, basically what you want to know is IF you could use Intercept right now, regardless of rage level and stance? So virtually there are only two conditions you need to know: [i]Is it off CD and do I have to correct range[/i, right]?

    If I'm correct with my assumptions so far (please correct me else :) ), I'd be using two triggers. First a simple cooldown trigger and second a range check trigger. Range checking requires use of custom trigger though.

    function () 
      return IsSpellInRange("Intercept", "target") == 1 

    should work. As far as I remember, there where no event updates for range checking, so you need to use "EveryFrame" as update frequency.

    PS: On a sidenode Mirrornm, do you think we could get "throttled OnUpdate" too? Eg, by internally using AceTimer-3.0's ScheduleRepeatingTimer(callback, delay).

    Last edited Jun 06, 2011 by CommanderSirow
    #3 Jun 06, 2011 at 18:08 UTC - 0 likes

    @CommanderSirow: GoHi Commander!

    If spell_update_usable looks at the necessary conditions to use it, then in that case it will be the wrong bit of code. Also, I had another look and that's an event, not a message so it's in the wrong place anyway if I were to use it! (Duh, Winning)

    So yes, all I need to know is if it's off CD, ignoring range, rage and stance.

    In which case I'm guessing SPELL_UPDATE_COOLDOWN would be more along the correct direction?:

    if(event == "SPELL_UPDATE_COOLDOWN" and UnitIsUnit(source or "", "player") and spellName == "Intercept") then
            WeakAurasTimers:ScheduleTimer(WeakAuras.ScanEvents, 5, "INTERCEPT_END")
            return true

    p.s.: this is some real copy paste / modding of code, do forgive my terrible amateurness. cutting corners never really ... cuts it.

    #4 Jun 06, 2011 at 18:32 UTC - 0 likes

    If you only happen to be interrested in if the spell is off cooldown (+ range checking), than you can use the build in spell-cooldown trigger for that, no need for a custom trigger. ;)

    Also going with the info here http://wowprogramming.com/docs/api/IsUsableSpell , this might simply work as well

    function ()
      local isUsable, noPower = IsUsableSpell("Intercept")
      return isUsable or noPower

    But I don't really know what IsUsableSpell will take into account and if noPower is only true if power is the only limiting factor to the spell being usable (which I'm assuming)

    Last edited Jun 06, 2011 by CommanderSirow
    #5 Jun 06, 2011 at 18:56 UTC - 0 likes
    Quote from CommanderSirow: Go

    you can use the build in spell-cooldown trigger for that, no need for a custom trigger. ;)

    Hm, I must be doing something wrong, but I can't see what it is....


    I'm getting the kids to bed now, but will check again later! Thanks for your input so far!

    #6 Jun 07, 2011 at 00:32 UTC - 0 likes

    I think you need to use Cooldown Progress (Spell) and set it to inverse. Cooldown Ready (Spell) was good for other uses (display short notification when spell gets ready). ;)

    #7 Jun 07, 2011 at 12:15 UTC - 0 likes

    Hi again!

    After a few tries at attempting to figure an untrigger and so on, I've settled for Cooldown Progress (Spell) with inverse. It might not show me the timer countdown, or the visual cooldown progress on the icon but it does warn me regardless of stance, so that's good enough for the mean time!

    Would it be possible to implement the feature of having cooldown icon/timer in a future release? I think a lot of us warriors would love to see that :)

    Thanks again for your help!

    #8 Jun 07, 2011 at 23:19 UTC - 0 likes

    There are ways of displaying cooldown overlays and timers on Icon displays, but I don't really understand what exactly you would be timing in this particular circumstance...

    #9 Jun 07, 2011 at 23:51 UTC - 0 likes

    If you want to have both, a timer/icon that count down, when the cooldown will be finished AND display icon as warning when it is done (cooldown ready), you will need to use 2 displays for this.

    One with Cooldown Progress (Spell) for displaying a timer and one Cooldown Progress (Spell) set to inverse to display the a persistent "finished" notification or a Cooldown Ready (Spell) trigger with timed = x-seconds to display a "finished" warning that will display for x seconds.

    Last edited Jun 07, 2011 by CommanderSirow
  • 9 posts

You must login to post a comment. Don't have an account? Register to get one!