WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   SendChatMessage and illegal chars (https://www.wowinterface.com/forums/showthread.php?t=45493)

Phanx 01-18-13 11:55 PM

To clarify, what PhantomSD posted does not let you "write in other players' GUILD/OFFICER/RAID channel using AddMessage". It only allows you to show messages in your own local chat frame that look like GUILD/OFFICER/RAID messages, but are not actually in those channels.

SDPhantom 01-22-13 05:52 PM

I guess I got a little confused on what the OP wanted to do. I thought we were still talking about links. :p
My explanation on channel links are to allow the user of the addon to click the link and open chat to that channel (relative to the user of course).

I'm going to try to condense this entire conversation into an easy explanation. To start with, we'll examine what happens when you send a message into chat. It all starts with a call to SendChatMessage(), which in turn, sends the message out to the chat servers. This is all it does, this function alone has nothing to do with displaying anything to the user. In addition to forwarding the message out to the intended people, the chat server responds with an echo, the message you sent as normal chat event. This is picked up by the OnEvent handler of any frame that has the respective event registered. The OnEvent handler set on the ChatFrames process this echo that looks exactly like any other chat message, formats it, and calls ChatFrame:AddMessage() to display it. This should explain what the difference is between these two functions.

On to UI Escape Sequences. These generally can be used on any widget that displays text, like FontStrings. Though, ChatFrames are the only widget that allows you to click links. This is the only part of the WoW API where these are of any significance. Everywhere else, they're nothing more than just contents of a string. When it comes to sending a message though SendChatMessage(), with few exceptions, UI Escape Sequences are forbidden. These exceptions being full links (links including the appropriate color codes generated with them). Note that not all links are supported by SendChatMessage(). Additional restrictions do apply.

For more information, see the following links:
SendChatMessage()
ChatFrame:AddMessage()
UI Escape Sequences

Phanx 01-22-13 07:39 PM

Quote:

Originally Posted by SDPhantom (Post 272264)
I guess I got a little confused on what the OP wanted to do. I thought we were still talking about links. :p

He wanted to write colored words in the middle of chat messages in other players' chat windows. The discussion of links came up when someone mentioned that player/item/other links can be sent in chat messages and will be automatically colored in the receiving player's chat window. Other than that, there is no way to send colors as part of your chat message. The receiving player may be using an addon that adds colors to the local display of messages, but you can't send the color codes to be seen by players not using such addons.

gmarco 01-23-13 01:24 PM

Thanks very much for the explanations.

I really appreciate them and I like very much to learn from them.

Phanx is correct when she says I wanna write in colored mode. But what I really liked to do was to send the player name only in class color, like I send the link of the spell (colored and linked). But as we have discussed there is no way to escape this like the spell.

Thanks again for the explanation on the globals ...


All times are GMT -6. The time now is 06:06 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI