Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Thu Apr 03, 2008 2:02 am   

Color
 
How do I specify specific colors? I don't like using the limits of color names, I'd prefer to color using the RGB system (255,255,255) but I dont know precisely it works out.

#REGEX {^You tell the group '.*'} {#COLOR <blank>}
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Thu Apr 03, 2008 2:38 am   
 
The help is my friend. You should read it sometime.
Quote:
Supports numeric values generated with the %color function, desciptive values including those listed in the %colorname function, and RGB values in hexadecimal format preceded by a $.
#COLOR
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Thu Apr 03, 2008 3:38 am   
 
I read that, my trigger still didn't fire and it does a terrible job of explaining how the RGB workds in CMUD (why can't it just be (x,y,x) ?
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Dharkael
Enchanter


Joined: 05 Mar 2003
Posts: 593
Location: Canada

PostPosted: Thu Apr 03, 2008 7:09 am   
 
There are numerous sites out there that can help you convert your RGB values to Hex values
Just do a search for RGB to Hex
You'll enter something like 255,255,204 and it will return FFFFCC
your #COLOR command then becomes.
#COLOR $FFFFCC

chamenas wrote:
...(why can't it just be (x,y,x) ?

If it was (x,y,z) someone would be asking "Why can't be Hex?"
_________________
-Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style."
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Thu Apr 03, 2008 8:40 am   
 
Dharkael wrote:
There are numerous sites out there that can help you convert your RGB values to Hex values
Just do a search for RGB to Hex
You'll enter something like 255,255,204 and it will return FFFFCC
your #COLOR command then becomes.
#COLOR $FFFFCC

chamenas wrote:
...(why can't it just be (x,y,x) ?

If it was (x,y,z) someone would be asking "Why can't be Hex?"


aka, why can't it be both!
Reply with quote
Larkin
Wizard


Joined: 25 Mar 2003
Posts: 1113
Location: USA

PostPosted: Thu Apr 03, 2008 11:31 am   
 
I don't use the hex codes, ever. I only use the HTML color names. Much clearer when reading my code, and I don't have to play around with any hex values.
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Thu Apr 03, 2008 12:07 pm   
 
Color names are limiting. Not to mention, the red default isn't red. It's dark red....
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Thu Apr 03, 2008 1:25 pm   
 
Here is a nice page for picking your colors using HEX or RGB and converting between them.

http://www.drpeterjones.com/colorcalc/
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Thu Apr 03, 2008 9:44 pm   
 
Quote:
aka, why can't it be both!
Zugg really shouldn't spend his time trying to intentionally make it so everything allows 6 different of doing it. The zScript language itself is usually flexible enough that there are multiple ways to do any given thing. The power of that language is in the user hands.

Quote:
I read that, my trigger still didn't fire...
Making the trigger fire has nothing to do with the #COLOR command or your original question. Please refer to the various helps #TRIGGER #REGEX and their related topics.

Quote:
...it does a terrible job of explaining how the RGB workds in CMUD...
Yep, a little vague, but that is by design. I actually wrote that particular piece of the help system a number of years ago. I figured that I really should add a reference to a mostly unknown syntax there. I also decided that it should be vague enough so that I wouldn't have to answer tons of support questions about it. Since then I seen many users make use of it on the forums. I would have to say that the way it was written is just right.

Now, since zScript is so wonderfully flexible, here is a function you can use to extend all your uses of #COLOR, #CW, #SUB, #PSUB, etc.
Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <func name="RGB" type="Literal" copy="yes">
    <value>#RESULT ""
$Val=(($Red*256+$Green)*256+$Blue)
$Ret=%mss(%concat("Hex(",$Val,")"))
#IF (%len($Ret)<=6) {#RETURN %left(%concat("#",%rightback(%concat("000000",$Ret),6)),7)}</value>
    <arglist>$Red, $Green, $Blue</arglist>
  </func>
</cmud>
I am sure you will notice that I used # instead of the documented $ for signalling the hex number. This is actually very intentional because MXP uses the pound. The various #COLOR command actually support it, but I never added it to the documentation because there were occasional parsing problems with it in zMud. Perhaps both characters deserve to be documented for CMud, but I will worry about that later.

Enjoy, and a general vague apology for sounding rude earlier. Bad days at work throw my entire life off.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Thu Apr 03, 2008 10:49 pm   
 
Quote:
Not to mention, the red default isn't red. It's dark red....

That's because of zMUD compatibility. In this case, "red" is referring to your ANSI color code. So it's dark red because that is what color you have assigned to your ANSI "red" code. If you want the HTML color, you can use the name "mxpred". This only happens for the cases where the HTML color name was the same as the ANSI color name. I had to preserve the ANSI color as the default for compatibility.
Quote:
(why can't it just be (x,y,x) ?

Because CMUD supports *STANDARDS*. The #RRGGBB format is the standard used for HTML and web pages. Is is the most common system used to specify RGB color values for programmers (as opposed to graphics artists who have about fifty million ways to specify color values, and CMUD isn't Photoshop!). The (x,y,z) format isn't used by any software that I can think of off the top of my head. And as people have already mentioned, you can always write your own function to do that.

But CMUD is supporting the web standards. The color names are HTML standard names, and the RGB syntax is the HTML standard for colors.
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Fri Apr 04, 2008 2:13 am   
 
But I use photoshop, and I use it well. I use rgb(x,y,z) in all my CSS :P
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Larkin
Wizard


Joined: 25 Mar 2003
Posts: 1113
Location: USA

PostPosted: Fri Apr 04, 2008 2:22 am   
 
Vijilante provided you with a CMUD function that will allow you to do @RGB(x, y, z) in your #COLOR command parameter, so there you go!
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Fri Apr 04, 2008 2:35 am   
 
I completely missed it. But I need to look at it and understand how it works first. And I'm in a bad mood myself right now.
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net