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.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ General
➜ How to get the exact colour codes sent in by the MUD?
|
How to get the exact colour codes sent in by the MUD?
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| VBMeireles
Brazil (47 posts) Bio
|
| Date
| Tue 22 Mar 2016 05:11 PM (UTC) Amended on Tue 22 Mar 2016 05:14 PM (UTC) by VBMeireles
|
| Message
| I play a MUD which supports the customization of its colours through "XTERM" colour codes.
This is an excerpt of this MUD's "help colour":
As your client supports 256 colours, you may also specify a three digit 'rgb' sequence, with each digit representing a colour intensity from 0 to 5 (eg '533' for pink, '530 for orange, etc).
I've customized my colours to my taste (they were too bright): http://imgur.com/a/AixnZ
My problem, however, is that I have some script lines which "replace" some lines sent by the MUD and I haven't been able to guess which colour codes the MUD is using exactly.
For example, when I replace a line that contains a word that is in "aqua" (at least to my eyes), using "aqua" as the foreground option in ColourNote() gives me a color that is slightly off (a bit brighter) than the "aqua" actually used by the MUD.
It can easily be seen in the second picture that the tone of aqua (the MUD's aqua) used in "a sapphire ring of power" is different than the aqua (my ColourNote("aqua")) used in "A rare relic".
Is there a way for me to retrieve the actual code sent by the MUD for his "aqua" in order for me to replicate it exactly?
Thank you.
EDIT: The tone of "aqua" sent by the MUD was setup through the following command "colour rare 144" as explained in its "help colour". So I need to figure out what will make MUSHclient give me the same colour as the MUD gives me from this "144" colour code. |
Vinícius | | Top |
|
| Posted by
| Wuggly
USA (112 posts) Bio
|
| Date
| Reply #1 on Tue 22 Mar 2016 08:43 PM (UTC) Amended on Tue 22 Mar 2016 10:38 PM (UTC) by Wuggly
|
| Message
| Made you a quick plugin to read the styles on each line to get the color code.
Start reading them by typing "read styles on" and stop it with "read styles off"
 |
To save and install the Style_Reader plugin do this:
- Copy between the lines below (to the Clipboard)
- Open a text editor (such as Notepad) and paste the plugin into it
- Save to disk on your PC, preferably in your plugins directory, as Style_Reader.xml
- Go to the MUSHclient File menu -> Plugins
- Click "Add"
- Choose the file Style_Reader.xml (which you just saved in step 3) as a plugin
- Click "Close"
|
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<muclient>
<plugin
name="Style_Reader"
author="Fumino"
id="0e24a1ea965f38cf243e5135"
language="Lua"
purpose="Get the styles of each line"
date_written="2016-03-22 00:49:31"
requires="4.51"
version="1.0"
>
<description trim="y">
Style runs
</description>
</plugin>
<triggers>
<trigger
enabled="n"
keep_evaluating="y"
match="^(.+)$"
regexp="y"
name="read_lines"
script="check_lines"
sequence="100"
>
</trigger>
</triggers>
<aliases>
<alias
match="^read styles (on|off)$"
enabled="y"
regexp="y"
send_to="12"
sequence="100"
>
<send>
if "%1" == "on" then
ColourNote ("silver", "", "Read Styles: ", "green", "", "Enabled")
EnableTrigger ("read_lines", true)
else
EnableTrigger ("read_lines", false)
ColourNote ("silver", "", "Read Styles: ", "red", "", "Disabled")
end -- if
</send>
</alias>
</aliases>
<script>
<![CDATA[
require "getstyle"
require "tprint"
function check_lines (name, line, wildcards, styles)
tprint (styles)
end -- function check_lines
]]>
</script>
</muclient>
You'll see something like this for every line when it's enabled.
1:
"textcolour"=12632256
"backcolour"=0
"length"=1
"style"=0
"text"="blah blah blah"
Take note of the textcolour number and add that into your ColourNote.
ie:
ColourNote (RGBColourToName "12632256", "", "rare")
EDIT: Fancied up the plugin a bit. | | Top |
|
| Posted by
| Fiendish
USA (2,541 posts) Bio
Global Moderator |
| Date
| Reply #2 on Tue 22 Mar 2016 08:44 PM (UTC) Amended on Tue 22 Mar 2016 08:46 PM (UTC) by Fiendish
|
| Message
|
Quote: As your client supports 256 colours, you may also specify a three digit 'rgb' sequence, with each digit representing a colour intensity from 0 to 5 (eg '533' for pink, '530 for orange, etc).
That only lets you choose 216 colors. I assume some colors are considered off limits, then? Maybe the really dark hard to see ones?
Quote: Is there a way for me to retrieve the actual code sent by the MUD
Yes. Two ways.
If your trigger is in a plugin, and it sends to a Lua script function (this is what Wuggly's example is doing), the function will accept 4 input arguments, like so:
function my_trigger (name, line, wildcards, styles)
end -- function my_trigger
That fourth argument, styles, contains a Lua table of something called style runs.
A style run is a Lua table containing the text, number of characters, foreground color, background color, and bold/italic/underline for every section of the line where the style changes. The foreground/background color fields will give you exactly what you want.
If your trigger is not in a plugin, or does not send to a Lua script function, you can have it "Send to Script (after omit)" and then when processing the trigger it will populate a variable called TriggerStyleRuns for you that contains the same information as above.
For more information read: http://www.mushclient.com/forum/?id=7818 and http://www.mushclient.com/forum/?id=8034 |
https://github.com/fiendish/aardwolfclientpackage | | Top |
|
| Posted by
| Nick Gammon
Australia (23,165 posts) Bio
Forum Administrator |
| Date
| Reply #3 on Tue 22 Mar 2016 09:02 PM (UTC) |
| Message
| |
| Posted by
| VBMeireles
Brazil (47 posts) Bio
|
| Date
| Reply #4 on Tue 22 Mar 2016 11:34 PM (UTC) |
| Message
| I got 14145375 out of a column's style.textcolour, however trying to ColourNote(14145375, "black", "something") results in the default Note() colour.
What am I doing wrong?
Side question: Would anybody care to explain why it only works if I "send to script (after omit)"? Are the different "send to" options detailedly documented anywhere? |
Vinícius | | Top |
|
| Posted by
| Fiendish
USA (2,541 posts) Bio
Global Moderator |
| Date
| Reply #5 on Wed 23 Mar 2016 12:09 AM (UTC) Amended on Wed 23 Mar 2016 12:10 AM (UTC) by Fiendish
|
| Message
| Try ColourNote(RGBColourToName(14145375), "black", "something")
VBMeireles said:
Side question: Would anybody care to explain why it only works if I "send to script (after omit)"?
Because you're either not in a plugin or you're not using Lua script body functions, and because that's just how MUSHclient is programmed to work. |
https://github.com/fiendish/aardwolfclientpackage | | Top |
|
| Posted by
| Nick Gammon
Australia (23,165 posts) Bio
Forum Administrator |
| Date
| Reply #6 on Wed 23 Mar 2016 04:05 AM (UTC) |
| Message
| |
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.
27,020 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top