Making prettier chat messages
My guild uses its own points system to allocate loot, and I'm in the process of writing a web-based system to manage it. One of the features of that system is going to be an addon in-game to report the number of points someone has when they roll. I have a couple of questions about this:
1) Is there a way to gag or append to a chat message that's coming in? I can use CHAT_MSG_SYSTEM and DEFAULT_CHAT_FRAME:AddMessage() to add another line, but I'd really like it to say "Joe rolls 15 (1-100) (15 points)" to save some space. 2) Is there a way to set the chat colour for individual parts of a message? It'd be nice if I could colour, say, the points value differently to the rest of the text. Thanks in advance for your help :) |
Quote:
You can change the color of text in local messages, but you cannot change the color of text in a chat channel. This limitation shouldn't be a problem if you're trying to alter the message locally anyway. You do it with color escape codes. print("|cAARRGGBBText|r") A = Alpha, R = Red, G = Green, B = Blue hex values. print("|cffFF0000This text is red|r This text is white |cff00FF00This text is green|r |cff0000FFThis text is blue|r") |
Thanks for that pointer on chat filters, that's very useful. It's CHAT_MSG_SYSTEM for rolls btw.
But I can't get your examples of changing chat colours to work in-game. If I enter /script print("|cffFF0000This text is red|r This text is white |cff00FF00This text is green|r |cff0000FFThis text is blue|r") into a chat window, the colour codes aren't removed, they're printed verbatim. |
Quote:
print("\124cffFF0000This text is red\124r") The pipe character will work correctly when used in an addon's lua file, though. |
Quote:
|
Any chance you'll be releasing this system? I'd be interested in giving it a go if you are.
|
Code:
colors = { |
All times are GMT -6. The time now is 09:29 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI