Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > Code Gallery
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 04-07-2011, 08:36 PM
MrOmega MrOmega is offline
One More Time
MrOmega's Avatar
Join Date: Aug 2010
Location: TN, USA
Posts: 631
MrOmega is an unknown quantity at this point
Send a message via AIM to MrOmega Send a message via MSN to MrOmega Send a message via Yahoo to MrOmega
New Body Colors References

Dabbling and playing with the new color codes ( 0 - 169) for a total of 143 new colors (Shades of gray are list as both gray and grey making it 150 colors but grays/greys are the same color)

I posted this in another part of the forums, but I figure this is the correct places for them.

Here's a list of color code to the color names
(Note:indianred is the proper name for the hex code, but it always sets the color as white, not sure if Stefan used another name for that color.)

Graal Script Code:
  0 white
  1 
yellow
  2 
orange
  3 
pink
  4 
red
  5 
darkred
  6 
lightgreen
  7 
green
  8 
darkgreen
  9 
lightblue
 10 
blue
 11 
darkblue
 12 
brown
 13 
cynober
 14 
purple
 15 
darkpurple
 16 
lightgray
 17 
gray
 18 
black
 19 
transparent
 20 
aliceblue
 21 
antiquewhite
 22 
aqua
 23 
aquamarine
 24 
azure
 25 
beige
 26 
bisque
 27 
black
 28 
blanchedalmond
 29 
blue
 30 
blueviolet
 31 
brown
 32 
burlywood
 33 
cadetblue
 34 
chartreuse
 35 
chocolate
 36 
coral
 37 
cornflowerblue
 38 
cornsilk
 39 
crimson
 40 
cynober
 41 
darkblue
 42 
darkcyan
 43 
darkgoldenrod
 44 
darkgray
 45 
darkgrey
 46 
darkgreen
 47 
darkkhaki
 48 
darkmagenta
 49 
darkolivegreen
 50 
darkorange
 51 
darkorchid
 52 
darkred
 53 
darksalmon
 54 
darkseagreen
 55 
darkslateblue
 56 
darkslategray
 57 
darkslategrey
 58 
darkturquoise
 59 
darkviolet
 60 
deeppink
 61 
deepskyblue
 62 
dimgray
 63 
dimgrey
 64 
dodgerblue
 65 
feldspar
 66 
firebrick
 67 
floralwhite
 68 
forestgreen
 69 
fuchsia
 70 
gainsboro
 71 
ghostwhite
 72 
gold
 73 
goldenrod
 74 
gray
 75 
green
 76 
greenyellow
 77 
grey
 78 
honeydew
 79 
hotpink
 80 
indianred "Incorrect color name? Won't set with name, but will with 80."
 
81 indigo
 82 
ivory
 83 
khaki
 84 
lavender
 85 
lavenderblush
 86 
lawngreen
 87 
lemonchiffon
 88 
lightblue
 89 
lightcoral
 90 
lightcyan
 91 
lightgoldenrodyellow
 92 
lightgray
 93 
lightgrey
 94 
lightgreen
 95 
lightpink
 96 
lightsalmon
 97 
lightseagreen
 98 
lightskyblue
 99 
lightslateblue
100 
lightslategray
101 
lightslategrey
102 
lightsteelblue
103 
lightyellow
104 
lime
105 
limegreen
106 
linen
107 
magenta
108 
maroon
109 
mediumaquamarine
110 
mediumblue
111 
mediumorchid
112 
mediumpurple
113 
mediumseagreen
114 
mediumslateblue
115 
mediumspringgreen
116 
mediumturquoise
117 
mediumvioletred
118 
midnightblue
119 
mintcream
120 
mistyrose
121 
moccasin
122 
navajowhite
123 
navy
124 
oldlace
125 
olive
126 
olivedrab
127 
orange
128 
orangered
129 
orchid
130 
palegoldenrod
131 
palegreen
132 
paleturquoise
133 
palevioletred
134 
papayawhip
135 
peachpuff
136 
peru
137 
pink
138 
plum
139 
powderblue
140 
purple
141 
red
142 
rosybrown
143 
royalblue
144 
saddlebrown
145 
salmon
146 
sandybrown
147 
seagreen
148 
seashell
149 
sienna
150 
silver
151 
skyblue
152 
slateblue
153 
slategray
154 
slategrey
155 
snow
156 
springgreen
157 
steelblue
158 
tan
159 
teal
160 
thistle
161 
tomato
162 
turquoise
163 
violet
164 
violetred
165 
wheat
166 
white
167 
whitesmoke
168 
yellow
169 
yellowgreen 
Attached it a function that will return an entire of array with a name, corename, hex, RGB, HSL and HSV.
the format for the array goes as
Graal Script Code:
{  NAMECORENAMEHEX, { REDGREENBLUE}, { HUE, {SATURATIONLIGHT}, {SATURATIONVALUE}}} 
example (I store the function in a class called 'core')
Graal Script Code:
//#CLIENTSIDE
function onCreated()
{

  
this.join"core");
  
this.newColors core::getColors();

}

function 
ChatBar.onAction()
{
  
  
temp.tokens ChatBar.text.tokenize();

  if ( 
temp.tokens.size() == && temp.tokens0] == "/getColor" && inttemp.tokens1]) in 0169| && temp.tokens1].length() in 13|)
  {

    
ChatBar.text "";    
    echo( 
"The color '" this.newColorstemp.tokens1]][ 0] @ "', has the RGB values of" SPC this.newColorstemp.tokens1]][ 3] @".");

  }

If you would type 157 and press enter the output would be
Graal Script Code:
The color 'Steel Blue'has the RGB values of "0.27,0.51,0.71"
I figure someone could make a nice looking palette using the RGB/HSL/HSV values.
Also attached is a palette I made following the color code.
Attached Thumbnails
Click image for larger version

Name:	attachment.png
Views:	423
Size:	1.4 KB
ID:	52682  
Attached Files
File Type: txt graal_BodyPalette.txt (21.0 KB, 189 views)
__________________
Time is the fire in which we burn...
Up, Up, Down, Down, Left, Right, Left, Right, B, A, Select, Start! Now I got 99 LIVES!!!

Last edited by MrOmega; 04-07-2011 at 08:56 PM..
Reply With Quote
  #2  
Old 04-07-2011, 09:07 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
Thanks @ indianred, it will be fixed in the next version.
Reply With Quote
  #3  
Old 04-07-2011, 09:22 PM
WhiteDragon WhiteDragon is offline
Banned
Join Date: Feb 2007
Posts: 1,002
WhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to behold
Just curious, since there are fairly simple formulas to convert between RGB, HSL, and HSV, why'd you write them all out?
Reply With Quote
  #4  
Old 04-07-2011, 09:23 PM
Shards-Of-Fate Shards-Of-Fate is offline
Mr. Blu
Shards-Of-Fate's Avatar
Join Date: Sep 2002
Location: Austin, TX, USA
Posts: 215
Shards-Of-Fate will become famous soon enough
Send a message via AIM to Shards-Of-Fate Send a message via MSN to Shards-Of-Fate Send a message via Yahoo to Shards-Of-Fate
Wait, my apologies for sounding completely out of the loop.

>_> Are you saying that there's 150 colors people can set their bodies to?
__________________

Weee!~
Reply With Quote
  #5  
Old 04-07-2011, 09:25 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Can you do something like player.colors[i] = 37; or does it have to be the actual color name (as a string)?
__________________
Reply With Quote
  #6  
Old 04-07-2011, 10:04 PM
MrOmega MrOmega is offline
One More Time
MrOmega's Avatar
Join Date: Aug 2010
Location: TN, USA
Posts: 631
MrOmega is an unknown quantity at this point
Send a message via AIM to MrOmega Send a message via MSN to MrOmega Send a message via Yahoo to MrOmega
Quote:
Originally Posted by WhiteDragon View Post
Just curious, since there are fairly simple formulas to convert between RGB, HSL, and HSV, why'd you write them all out?
No real reason, just figured it be quicker to read an array than to compute a value.

Quote:
Originally Posted by Shards-Of-Fate View Post
Wait, my apologies for sounding completely out of the loop.

>_> Are you saying that there's 150 colors people can set their bodies to?
Yes there are 150 but there are duplicates such as gray and grey.

Quote:
Originally Posted by cbk1994 View Post
Can you do something like player.colors[i] = 37; or does it have to be the actual color name (as a string)?
Yes you can set the color by the value, not just the string name.
__________________
Time is the fire in which we burn...
Up, Up, Down, Down, Left, Right, Left, Right, B, A, Select, Start! Now I got 99 LIVES!!!
Reply With Quote
  #7  
Old 04-08-2011, 08:29 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
I was curious to see what kind of range of the rainbow we had so I also generated a palette. Left out the monotone colors.
Attached Thumbnails
Click image for larger version

Name:	selectiverainbow.PNG
Views:	204
Size:	4.8 KB
ID:	52684  
__________________
Quote:
Reply With Quote
  #8  
Old 04-08-2011, 09:51 AM
MrOmega MrOmega is offline
One More Time
MrOmega's Avatar
Join Date: Aug 2010
Location: TN, USA
Posts: 631
MrOmega is an unknown quantity at this point
Send a message via AIM to MrOmega Send a message via MSN to MrOmega Send a message via Yahoo to MrOmega
definitely an improvement over what we had before.
__________________
Time is the fire in which we burn...
Up, Up, Down, Down, Left, Right, Left, Right, B, A, Select, Start! Now I got 99 LIVES!!!
Reply With Quote
  #9  
Old 04-11-2011, 05:01 AM
MrOmega MrOmega is offline
One More Time
MrOmega's Avatar
Join Date: Aug 2010
Location: TN, USA
Posts: 631
MrOmega is an unknown quantity at this point
Send a message via AIM to MrOmega Send a message via MSN to MrOmega Send a message via Yahoo to MrOmega
figure I show how to convert RGB to HSL to RGB
Graal Script Code:
function HSL2RGBtemp.huetemp.sattemp.lum)
{

  
temp.chroma = ( abstemp.lum 1)) * temp.sat;
  
temp.hue    temp.hue 60;
  
temp.xVal   temp.chroma * ( abs(( temp.hue 2) - 1));
  
temp.r      temp.hue == 00temp.hue 1temp.chromatemp.hue 2?   temp.xValtemp.hue 3?           0temp.hue 4?           0temp.hue 5?   temp.xValtemp.chroma;
  
temp.g      temp.hue == 00temp.hue 1?   temp.xValtemp.hue 2temp.chromatemp.hue 3temp.chromatemp.hue 4?   temp.xValtemp.hue 5?           0:           0;
  
temp.b      temp.hue == 00temp.hue 1?           0temp.hue 2?           0temp.hue 3?   temp.xValtemp.hue 4temp.chromatemp.hue 5temp.chroma:   temp.xVal;                 
  
temp.m      temp.lum 0.5 temp.chroma;          
 
  return { 
temp.temp.mtemp.temp.mtemp.temp.m};
 
}

function 
RGB2HSLtemp.rtemp.gtemp.b)
{

    
temp.max maxmaxtemp.rtemp.g), temp.b);
    
temp.min minmintemp.rtemp.g), temp.b);
    
temp.chroma temp.max temp.min;
    
temp.= (( temp.r) - temp.temp.b) / 2;
    
temp.= (( 0.5) / 2) * ( temp.temp.b);
    
temp.hue arctantemp.temp.a);
    
temp.lum 0.5 * ( temp.max temp.min);
    
temp.sat temp.chroma == 00: ( temp.chroma / ( abstemp.lum 1)));
    
  return { 
intradToDegtemp.hue) % 360), temp.sattemp.lum};


and now an example to find the Inverted color of an HSL color

lets say we want to find the inverted RGB color with red's HSL

Graal Script Code:
function onCreated()
{

  
temp.red = { 010.5}; //Red's HSL
  
temp.inv HSL2RGB(( temp.red0] - 180) % 360temp.red1], temp.red2]);
  echo( 
temp.inv);


which you get { 0, 1, 1} which is Cyan's RGB
__________________
Time is the fire in which we burn...
Up, Up, Down, Down, Left, Right, Left, Right, B, A, Select, Start! Now I got 99 LIVES!!!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 02:06 PM.


Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (C) 1998-2008 Linux cyberjoueurs All Rights Reserved.