Weakaura Question

Hello Forum Friends,

I have a question I really hope someone could help with.

I’ve created a bunch of macros & a weakaura for guldies not on voice for Mekkatorue fights (we got into raiding very late this expac) and there’s one more change that I just can’t seem to figure out.

Here’s what I have so far:

  • Macros that whisper the colour of the shape above the player to them

  • 5 triggers (one for each colour)

  • Weakaura that displays that “ClickMe” text on screen with the text colour changing according to the colour that was whispered to them.

Here is my problem though. After 24 hours of searching I can’t find a way to change the actual text according to the trigger. So, if someone whispered “RED” I want the text to both display the word “RED” and have the text display as red.

I am very much a novice as these things but I’m learning fast, and finding it strangely enjoyable.

If anyone would be so kind as to point me in the right direction I’d be eternally grateful!

I am at work right now so I’m not able to link/ copy anything for a few hours.

If you are using a chat message trigger from the UI dropdown boxes, I don’t think it will store whatever was whispered in any way. It’s also not needed to make 5 triggers for the different colors, since they are all basically just doing the same thing.

Make a custom trigger with Type: Custom and Event Type: Event for the event CHAT_MSG_WHISPER. Then enter a custom function that takes the text received from the event and stores it in the table called aura_env. This table is special and will be accessible from any custom code.

function(event, text, playerName)
    -- possibly verify if playerName is someone in your raid?
    if text == "red" then
        aura_env.color = "red"
        return true
    elseif text == "blue" then
        aura_env.color = "blue"
        return true

    -- etc..

    end
end

Then under display set the text to %c to create a custom display function. You can set the updating to Trigger Update instead of Every Frame to make it a bit less resource hungry. As display function use something like this.

function()
    return aura_env.color
end

Now it should show you red or blue depending on which was whispered.

To color the text you need to use something like |cFFFF0000 for red. It’s basically a hex code like you’d see in html but with added alpha channel channel, |cAARRGGBB. Blizzard has defined some common colors in FrameXML/Constants.lua, for example RED_FONT_COLOR_CODE.

So now you can change the previous function to something like

function()
    return RED_FONT_COLOR_CODE .. aura_env.color
end

You will also need some conditional code (or better yet, a table with all the whispered text matches and corresponding color) in the display function to change the color based on what was whispered, but I’ll leave that as an exercise for you.

2 Likes

Wow, thanks so much for the response Ebear :grin: I really wasn’t expecting anything so thorough! I appreciate it!

I will try to follow your advise ASAP and let you know how it goes.

Thank you again! :star_struck:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.