Colors for chat

Posted by Rinor on Sat 19 Jun 2004 04:42 AM — 5 posts, 22,124 views.

#0
Is it possible to customize chat so that it can have colors? Chat messages from me are cyann atm, I would like to change the color.
Australia Forum Administrator #1
In the chat configuration window you can customise the chat colour.

The chat protocol is designed for colours to be sent with chats, so it is possible that the sender is sending their own colours.

You can turn that off by checking "ignore incoming colours".

You could also modify the chat plugin to change the way incoming chat messages appear by making (say) poses and chats come out in different colours.
#2
What about chaging color for outgoing chat messages? People on my chat see my chat messages in cyan. I would like to try another color if that is possible.
Greece #3
I had that question too, how can you chat something with colors in it?
Australia Forum Administrator #4
There are ways ... :)

First thing you can do in scripting is to simply do chats directly via ChatMessage, like this:

/world.chatmessage 1, 5, vbCrLf & "aha - aha" & vbCrLf

What this does is send to chat session 1, chat message type 5 (Text_personal - these are documented in the Chat plugin), a message which does not have colour codes in it.

To do it to a person you could do:

/world.chatmessage ChatGetID ("nick"), 5, vbCrLf & "aha - aha" & vbCrLf

To do it to a group you would have to get a list of connected chat sessions using GetChatList and iterate through it (see the plugin for an example).

The linefeeds are part of the expected protocol, it may work to leave them out but not recommended, depending on what client the other player is using.




Probably more simply, just imbed the colour codes in your message using the Ansi function. eg. to chat in green:


mymessage = Ansi (32) & "hi there everyone"
world.execute "#chatall " & mymessage


What would happen here is that the chat system will set the message to cyan, but then you have immediately changed it to green, so the other player will see green.

This method has the benefit that you are using the existing aliases (eg. chatall, emote etc.) and are simply colouring the message it sends. Thus you don't have to muck around working out the correct chat code for each message type, and work through lists of connections.




What you could do to simplify things a bit more, if you don't mind changing the chat plugin itself, is to put in the codes (colours) you want into the various aliases in it.

eg.

Before ...

<aliases>
<alias
   match="&prefix;chatall *"
   enabled="y"
   send_to="12"
   sequence="100"
  >
  <send>ChatEverybody "%1", 0</send>
  </alias>
</aliases>


After ...

<aliases>
<alias
   match="&prefix;chatall *"
   enabled="y"
   send_to="12"
   sequence="100"
  >
  <send>ChatEverybody Ansi (32) & "%1", 0</send>
  </alias>
</aliases>


What this has done is put the "green" code into just before the message that is sent to ChatEverybody.