Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.
 Entire forum ➜ MUSHclient ➜ Plugins ➜ Colors for chat

Colors for chat

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Rinor   (16 posts)  Bio
Date Sat 19 Jun 2004 04:42 AM (UTC)
Message
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.
Top

Posted by Nick Gammon   Australia  (23,099 posts)  Bio   Forum Administrator
Date Reply #1 on Sat 19 Jun 2004 05:35 AM (UTC)
Message
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.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Rinor   (16 posts)  Bio
Date Reply #2 on Sat 19 Jun 2004 03:16 PM (UTC)
Message
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.
Top

Posted by Poromenos   Greece  (1,037 posts)  Bio
Date Reply #3 on Sat 19 Jun 2004 10:39 PM (UTC)
Message
I had that question too, how can you chat something with colors in it?

Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it!
Top

Posted by Nick Gammon   Australia  (23,099 posts)  Bio   Forum Administrator
Date Reply #4 on Sat 19 Jun 2004 11:38 PM (UTC)
Message
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.


- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


16,604 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.