1. #1
    Deleted

    Weakauras Custom Trigger & Untrigger

    Hey guys,

    i create a weakaura which should trigger when the debuff/buff is about to expire. The Trigger works perfectly. I test this with Spell Reflection is 2 seconds remaining. The problem is to untrigger the aura. I use Custom->Status->CheckOn: Every Frame. Just watch the code:

    CUSTOM TRIGGER
    Code:
    function () 
        
        
        local name, rank, icon, count, debuffType, duration, expirationTime, unitCaster, isStealable, 
        shouldConsolidate, spellId = UnitAura("player", "Spell Reflection")
        if  expirationTime - GetTime() <= 2   then
            return  true
        end
        return false
    end
    CUSTOM UNTRIGGER
    Code:
    function () 
        
        
        local name, rank, icon, count, debuffType, duration, expirationTime, unitCaster, isStealable, 
        shouldConsolidate, spellId = UnitAura("player", "Spell Reflection")
        if  expirationTime - GetTime() <= 0.1   then
            return  true
        end
        return false
    end
    If you have any ideas to fix it would be greatly appreciated

  2. #2
    Untrigger function is called only if trigger's return is nil/false.
    http://www.wowace.com/addons/weakaur...nd-untriggers/
    The trigger condition completely includes untrigger condition in your code, so untrigger will never return true(T⊃U implies ~T ⇒ ~U).


    What you want to do is "Show a display if 1) aura is up and 2) remaining time is less then 2 seconds."
    As it's complete On / Off status and you're using "every frames" check condition, both condition can be put in trigger function.

    Trigger:
    ...
    if expirationTime and expirationTime - GetTime() <= 2 then
    return true
    end
    ...


    Untrigger:
    function()
    return false
    end


    And you should put 'expirationTime and expirationTime - GetTime()' because arithmetic operation with nil causes Lua Error.
    Last edited by ekardnah; 2015-09-28 at 11:11 AM.

  3. #3
    Deleted
    WA can even do this without any custom coding. Just a regular aura trigger with remaining time constraint will do.

  4. #4
    Deleted
    I fixed the problem by adding an additional if.
    It´s working fine, but i will actually try doing this without custom code. Thanks for your reply!


    Code:
    function () 
        
        
        local name, rank, icon, count, debuffType, duration, expirationTime, unitCaster, isStealable, 
        shouldConsolidate, spellId = UnitDebuff("player", "Font of Corruption")
        if  expirationTime - GetTime() <= 0.1 then
            return false
            
        else  if  expirationTime - GetTime() <= 5    then
                return  true
            end
            return false
        end
    end

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •