1. #1
    Deleted

    WeakAuras custom trigger/untrigger

    Been trying to make a custom trigger and untrigger for when my pet's attack-ability is not on autocast. It's been working well, but a problem arises when I try and add a second spellname that it can also check for in an 'either or'-scenario, because of how petattacks are name things like "Claw" or "Bite", so I wouldn't be able to use the same aura for pets with 2 differently named attacks.

    This would be my trigger:

    Code:
    function()
        local autocastable_claw, autostate_claw = GetSpellAutocast("Claw")
        local autocastable_bite, autostate_bite = GetSpellAutocast("Bite")
        if (not autocastable_claw) or (not autocastable_bite) then
            return true
        end
    end

    And the untrigger:

    Code:
    function()
        local autocastable_claw, autostate_claw = GetSpellAutocast("Claw")
        local autocastable_bite, autostate_bite = GetSpellAutocast("Bite")
        if autocastable_claw or autocastable_bite then
            return true
        end
    end
    -- but it isn't working. The trigger seems to work but when I click the icon again to put it on autocast it seems that the untrigger doesn't fire.


    Hope someone can help me crack the code.
    Thanks in advance
    Last edited by mmoc36ab626ca9; 2014-06-10 at 05:34 PM.

  2. #2
    ~A+~B is not ~(A+B)

    If the trigger works fine, just invert it's output for the Untrigger (also add the else to the if, just to make sure):
    Code:
    function()
        local autocastable_claw, autostate_claw = GetSpellAutocast("Claw")
        local autocastable_bite, autostate_bite = GetSpellAutocast("Bite")
        if (not autocastable_claw) or (not autocastable_bite) then
            return false
        else
            return true
        end
    end

  3. #3
    Deleted
    Quote Originally Posted by moothz View Post
    ~A+~B is not ~(A+B)

    If the trigger works fine, just invert it's output for the Untrigger (also add the else to the if, just to make sure):
    Code:
    function()
        local autocastable_claw, autostate_claw = GetSpellAutocast("Claw")
        local autocastable_bite, autostate_bite = GetSpellAutocast("Bite")
        if (not autocastable_claw) or (not autocastable_bite) then
            return false
        else
            return true
        end
    end
    The trigger might be broken as it seems, your untrigger doesn't appear to work at my end so the trigger is possibly broken.

  4. #4
    trigger:
    Code:
    function()
        local autocastable_claw, autostate_claw = GetSpellAutocast("Claw")
        local autocastable_bite, autostate_bite = GetSpellAutocast("Bite")
        if (not autostate_claw) and (not autostate_bite) then
            return true
        end
    end
    untrigger:
    Code:
    function()
        return true
    end
    The return values of the spell of the pet you don't have out should always be nil. So you are just checking for the other one. Also you need to check the second return value of the function. See API_GetSpellAutocast.

    The trigger function should return "true" when the aura should be shown, if the trigger returns "false, nil, or nothing" the untrigger is called. If the untrigger returns "true" it hides the aura. See custom-triggers/
    Last edited by Crudor; 2014-06-10 at 08:53 PM.

  5. #5
    Deleted
    Quote Originally Posted by Crudor View Post
    trigger:
    Code:
    function()
        local autocastable_claw, autostate_claw = GetSpellAutocast("Claw")
        local autocastable_bite, autostate_bite = GetSpellAutocast("Bite")
        if (not autostate_claw) and (not autostate_bite) then
            return true
        end
    end
    untrigger:
    Code:
    function()
        return true
    end
    The return values of the spell of the pet you don't have out should always be nil. So you are just checking for the other one. Also you need to check the second return value of the function. See API_GetSpellAutocast.

    The trigger function should return "true" when the aura should be shown, if the trigger returns "false, nil, or nothing" the untrigger is called. If the untrigger returns "true" it hides the aura. See custom-triggers/
    Thank you so much, working perfectly. I'm still extremely new to lua/coding and just trying my way around stuff.
    Appreciate your help a lot.

Posting Permissions

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