Thread Tools Display Modes
01-18-13, 11:55 PM   #21
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
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.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
01-22-13, 05:52 PM   #22
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,325
I guess I got a little confused on what the OP wanted to do. I thought we were still talking about links.
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
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)

Last edited by SDPhantom : 01-22-13 at 05:59 PM.
  Reply With Quote
01-22-13, 07:39 PM   #23
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by SDPhantom View Post
I guess I got a little confused on what the OP wanted to do. I thought we were still talking about links.
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.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
01-23-13, 01:24 PM   #24
gmarco
An Onyxian Warder
 
gmarco's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 362
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 ...
__________________
This is Unix-Land. In quiet nights, you can hear the Windows machines reboot.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » SendChatMessage and illegal chars


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off