SendChatMessage and illegal chars
Hi all,
I continue to ask questions on questions and I am sorry about it, but I googled a lot but could not find a solution to this. I'd like to write something in a CHAT channel. And it works fine, but I was unable to write a something with the escape code to make string colored. A sample... Lua Code:
The print(msg?) works quite well but the SendChatMessage only work when the var is prgname2 because in the other case it contains illegal chars. I check them here: http://www.wowwiki.com/ValidChatMessageCharacters The problem is that the code doesn't complains but doesn't print either when it found such strings. I check also: Lua Code:
But it also don't print either and probably it is not I need. So the question is ? Have I to convert the string with some function before passing to SendChatMessage or I have to use different output type ? Thanks very much for attention as usual. |
You can't send coloured chat messages to other people, only show them for yourself using AddMessage().
SendAddonMessage uses a hidden channel to send data between addons, e.g. to synchronize timers or to check if someone has a newer version. |
Hi, thanks for your reply...
The code is this: Lua Code:
The print() works fine and I think I can use as a self output. The SendChatMessage is not able to to color both the "prgname" nor the color(destName) ... The only problem of this approach is that I have to deal with 2 different string format for the output if I'd like to mantain the colors in the "self" output. Btw if can't be solved it is not a problem, so ... :-) Thanks very much for your kind reply. |
I'm not sure what the problem is now. Like I said, you can't send coloured chat messages to other people.
If you only want to colour the print(), then you should use DEFAULT_CHAT_FRAME:AddMessage() instead. You can provide rgb values in the parameters so you don't need to format the string yourself. |
1 Attachment(s)
There wasn't any problems I was only explaining why I asked so I posted the real code :-)
Just to clarify better I post an image: http://s20.postimage.org/icdo1j1od/autopsy.png As you can see the print works fine coloring the addon name and the name of the mage pg (Frostanzo). The SendChatMessage(autopsy_msg, autopsy_chn) instead prints in the default chat color without any color modification for name and pg class. What I would to obtain was that the SendChatMessage(autopsy_msg, autopsy_chn) can write the same string of the print(), but you said it is not possible so I have to forget to have a colored chat :-) Thanks very much for your answers. I really appreciated. |
Also to add, there are special exceptions such as color codes that are associated with spell and item links as these codes are considered part of the link themselves by the chat server.
|
1 Attachment(s)
Hi,
thanks SDPhantom. I see that I can print escape code for players, spell and other things if they are hyperlinks. Lua Code:
But frankly I don't understand how to write in others players GUILD/OFFICER/RAID channel using the AddMessage. Probably I make mistakes in understanding the 2 different functions: AddMessage vs SendChatMessage They both can write in my ChatFrames, but I don't understand IF AddMessage can write in other players GUILD/OFFICER/RAID/INSTANCE_CHAT like SendChatMessage does. So I finish the addon using 2 different strings. The first with that I use with a print() (when self output is chosen) is colored and the second for the other channels is not :-) I attach the addon, autopsy, that is a minimal implementation of a death reports, if someone want to check it before the post to the public. Any comments are welcome. Lua Code:
prints in the chosen channel a fake announce to test. Thanks all again for your time. |
Quote:
Quote:
Here's an example of how it works: 1. Someone (maybe you) uses the SendChatMessage function to send a message to the GUILD channel. 2. The server receives the message, and sends it back to every player who is in the same GUILD channel. 3. Your client receives the message, and fires the CHAT_MSG_GUILD event to inform the UI (including addons) that a message was received in the GUILD channel. 4. The default UI processes the CHAT_MSG_GUILD event, formats the mesage with the channel and sender names, and calls the AddMesssage method on each of the default chat frames that are configured to show messages in the GUILD channel. AddMessage is a frame method, just like SetAlpha or ClearAllPoints, that all ScrollingMessageFrame type frames have. You can't call AddMessage for a chat frame on someone else's computer any more than you can call SetAlpha on a frame on someone else's computer. |
Hi Phanx ...
Thanks for your reply, everything is clear now (as usual when you explain :). I'd like to wish you and to the readers of the forum a merry christmas. Thanks to everyone. |
1 Attachment(s)
I'd like if possible to re-open this thread because there is a thing I don't understand.
I summarized :-) I wanted to write the name of the player in other's chat (party, raid. instance etc etc) colored by class. But the chat server always refused to process the "colored" name complaing about illegal chars (the escape codes). But it happily accepts the GetSpellLink(prefixParam1) that is the spell/ability casted. Now I see that other addons are able to write colored player name in the chat frame. I tried to understand how, but frankly I was not able to understand :-) I attach an output. As you see, axilea is my pg name and it is the killed one. Autopsy write in plain way while fatality is able to print class colored. The first pg name colored (axilea and gheedo) is colored by the chat addon and it is not related to the report. Any help / input / tips are welcome as usual. Thanks to everyone. |
It doesn't (Fatality).
The relevant code snippet is this Code:
local function colour(name) |
Uhm ... I don't understand.
I don't have fatality installed, I have autopsy, but I see the colored output of fatality that another member of my party, Gheedo, has installed. So fatality is writing in party chatframe I suppose because I see its output (colored) as the other party member see my output of autopsy (not colored) . Now I am lost ... :-) |
You likely have another addon that is processing player names and coloring them by class, outside of any other addon.
|
You most probably have a chat addon that colorizes your name. (NickAlert, a Prat module or similar)
|
:-)
Ehm probably yes :-) I use BasicChatMods (and with this Phanx will never aswered me again :-) and yes it colors the name of the player I suppose. Sorry to everyone for asking that silly question but I really don't think about this :-) |
1 Attachment(s)
Hi all,
don't want to continue this discussion so much to annoy everyone, but I continue to be a little curious about a thing. I post a screenshot of yesterday raid chat: The autopsy lines are correctly displayed by the chat mod in color for my name, but not for the others, i.e. Tullinhood ... and I have it clear why it happens. But what about the other pg names that some other addon wrote ? Morgy, Alexyel, Gheedo and Eiki. They are class colored. I have tried to check all Gara'jal addons I found on curese or wowi (and boss mode addon I use) but I didn't find i.e. the "Trapasso" keyword (with grep) on them ... Could be the game itself that prints such alerts in this way ? Thanks really so much to everyone. |
Fairly sure that's just the way DBM formats its chat messages.
|
Yes those are boss emotes (built-in boss warnings)
Edit: Or (because I can't be sure with your custom chat and client language) if it's a 3rd party bossmod it's printing to your chatframe where as discussed earlier escape codes are possible. It's not announcing to a public channel in other words. |
Thanks very much to everyones for your kind replies and time.
I think we can happily close this thread now :-) |
Quote:
Code:
CHAT_GUILD_GET = "|Hchannel:GUILD|h[Guild]|h %s:\32"; Numbered channels; |Hchannel:CHANNEL:1|h[1. General - Dalaran]|h. BNet conversations; |Hchannel:BN_CONVERSATION:1|h[11. Conversation]|h. Note BNet conversations start with an internal index of 1 instead of their displayed index of MAX_WOW_CHAT_CHANNELS+1. Note these are the links used to allow the user to click and open a chat message to the respective channel. These only work for chatframe:AddMessage() and will be refused by SendChatMessage(). |
All times are GMT -6. The time now is 11:25 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI