1. #1

    Weakauras: Text changes color conditionally

    Hello folks.

    I'm trying to do up a text aura in weakauras that will change color when I need to taunt off my cotank. I've got everything working about the aura except the color change. I dug up this old thread via google, but despite the function not throwing any errors, I can't figure out why it isn't changing color.

    I have the main color set to white and the "animation" color set to red, with the following under "Custom Function":
        local status = UnitThreatSituation("player", "target")
        if status==0 then return r1,g1,b1,a1 else return r2,g2,b2,a2 end
    Probably-irrelevant details:
    The aura itself triggers when it checks my cotank for a tank-swap mechanic debuff (Static Burst is what I'm using to start). It displays a small line of text stating he has Static Burst, with a %c that displays "TAUNT!" if I'm in threat status 0 (not tanking + lower on aggro table). This part works fine, but I am using nearly-identical code to change the color, and it's not working. I'm sure I'm missing something simple and would appreciate any help.

    For the sake of testing whether my code even works in the first place, I set up this one to tool around Vale of Eternal Blossoms taunting random unfortunate critters and beasts. If it works, it should always be either a red 3 or a white ?.

    Thanks in advance.

  2. #2
    Create two WeakAuras, one for red and one for white. It's the easiest and simplest solutions.


    First WA: Off tank doesn't have debuff to taunt - Text White
    Second WA: Off tank has debuff to taunt - Text Red

    Unless I'm missing something else that you are trying to do, this should work. This is what I would do.

  3. #3
    Thanks, but that's not really what I want.

    Other tank has no debuff: no aura
    Other tank has debuff but I have aggro on my target: white aura
    Other tank has debuff but I don't have aggro on my target: red aura

    If I do this without lua custom scripts, it's five auras per debuff I want to watch (no debuff, debuff plus threat condition 0, 1, 2, or 3). So no. I want to get this working, but thanks for the suggestion.

  4. #4
    Under the animation duration, did you set a time? If you leave that blank it won't change color.

  5. #5
    Quote Originally Posted by piefayth View Post
    Under the animation duration, did you set a time? If you leave that blank it won't change color.
    This was the problem. D'oh. Thank you!

    ---------- Post added 2013-04-12 at 04:58 PM ----------

    Follow-up question: Is there a way to import the values from your WA trigger to compare them in a custom lua function?

    For example: Show aura if co-tank has Static Wound. Custom lua function grabs stack count from YOUR Static Wound debuff and compares it to THEIR Static Wound debuff, then returns something depending on whether yours > theirs or vice versa.

    I realize I could just put the player's name directly into the custom lua, but it would be nice to pull from the settings of the aura itself. Something like:
        local _,_,_,theircount=UnitBuff("weakauratriggertarget","Static Wound")
        local name,_,_,mycount=UnitBuff("player,"Static Wound")
        if name ~= nil then
            if mycount < theircount then return "TAUNT!" else return "" end
        return "TAUNT!"
    Last edited by Eleri; 2013-04-13 at 01:03 AM.

  6. #6
    Have a look at the WeakAuras variable

    local name = GetUnitName(WeakAuras.CurrentUnit)

  7. #7
    You're awesome, thank you. This is exactly what I wanted.

Posting Permissions

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