Reply
Thread Tools Display Modes
Unread 01-18-13, 11:55 PM   #21
Phanx
A Pyroguard Emberseer
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 4,591
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.
__________________
Author/maintainer of Grid, PhanxChat, ShieldsUp, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
Phanx is offline   Reply With Quote
Unread 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: 1,065
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
__________________
"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.
SDPhantom is offline   Reply With Quote
Unread 01-22-13, 07:39 PM   #23
Phanx
A Pyroguard Emberseer
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 4,591
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.
__________________
Author/maintainer of Grid, PhanxChat, ShieldsUp, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
Phanx is offline   Reply With Quote
Unread 01-23-13, 01:24 PM   #24
gmarco
A Flamescale Wyrmkin
 
gmarco's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 107
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.
gmarco is offline   Reply With Quote
Reply

Go BackWoWInterface » Developer Discussions » Lua/XML Help » SendChatMessage and illegal chars

Thread Tools
Display Modes

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