Text Colors...

View previous topic View next topic Go down

Text Colors...

Post  Innocent on Sat Jan 05, 2013 11:48 pm

I see alot of ppl still using \c[NUMBER] and it annoys me pretty much. You know you can have richer colors using color codes?..
Sure, \c[NUMBER] is shorter, but you can make way much more thing with color code and I think it's important that you know how it's made.

Soz, the code goes like this: <color:CODE>
The code is basicly made of 6 parameters;
<color:FF0000> would make the text RED
<color:00FF00> would make the text GREEN
<color:0000FF> would make the text BLUE
Since you know this, you can make combos!
<color:FF00FF> would make the text PURPLE(; VIOLET)
<color:00FFFF> would make the text TEAL (; CYAN)
<color:FFFF00> would make the text YELLOW
Well, you can use your mind like a baws.. Or use this : ColorPicker

To use it in scripting, it goes like this (Exemples) :
Code:
announce("<color:FF0000 Hello World!");
Would announce "Hello World!"

Code:
$VariableWithCoolName="Hello World!"; announce("<color:0000FF>"@$VariableWithCoolName);
Would announce "Hello World!"

Code:
$Var1 = "Hello"; $Var2 = "World"; $Var3 = "!"; announce("<color:FF0000>"@$Var1 SPC "<color:00FF00>"@$var2@"<color:0000FF>"@$var3);
Would announce "Hello World!

Also, there's no trouble replacing the color code by a variable if you use it alot..
Code:
$SuperColor = "<color:FF00EE>"; announce($SuperColor@"Hello World!");
Would announce "Hello World!"

Hope you'll think about using it more often ;)

Also, if you don't understand the code I wrote above, take a look to: Torque-Script Guide
avatar
Innocent
Blocklandian

Posts : 17
Join date : 2012-12-31
Age : 21
Location : Montreal

View user profile

Back to top Go down

Re: Text Colors...

Post  Meshiest on Sun Jan 06, 2013 2:04 am

\c1
\c2
...

:3

Meshiest
Blocklandian

Posts : 68
Join date : 2013-01-02
Age : 20
Location : The Internet

View user profile http://marblemodz.forumotion.com

Back to top Go down

Re: Text Colors...

Post  Ipquarx on Mon Jan 07, 2013 3:34 pm

I think you should mention what the codes actually are, because if you don't know what they are then you shouldn't be using them, you should be using the \c codes.

What they ARE is really 3 sets of 2 hexadecimal characters, one for red, green, and blue.

That's why 555555 is gray, and AAAAAA is a darker gray, 000000 is white, and FFFFFF is black.

___________________________________________________
Were you expecting a signature?
avatar
Ipquarx
Blocklandian

Posts : 19
Join date : 2012-12-27
Age : 21
Location : Manitoba, Canada

View user profile http://www.Ipquarx.com

Back to top Go down

Re: Text Colors...

Post  Meshiest on Mon Jan 07, 2013 4:44 pm

Ipquarx wrote:I think you should mention what the codes actually are, because if you don't know what they are then you shouldn't be using them, you should be using the \c codes.

What they ARE is really 3 sets of 2 hexadecimal characters, one for red, green, and blue.

That's why 555555 is gray, and AAAAAA is a darker gray, 000000 is white, and FFFFFF is black.

OK-
Its like the RGB colors
"AmountRed AmountGreen AmountBlue"
But you count up to 255 with this "Base16" counting, like 1-10(woops) 0-9 is base10 and binary is base2
The numbers are 1-16(woops, again) 0-15
0 1 2 3 4 5 6 7 8 9 A B C D E F
so no red would be 00
and 2 green would be 02
and maybe you want 15 blue 0F

Its like counting up to 16 and then carrying a one:
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B ....
Since it goes up to 255 (which happens to be 16*16 - 1) (-1 because of zero) it is like counting up to 100 (10*10)

so if you wanted alot of red, make FF (which is 255)
if you wanted about 1/2 green, you would want about 127 which is 7F
ALSO
if you are too lazy to count in base16, just search "# in hex"
and it will read "0x##" which, the ## is hex for the number you searched

Is that good?


Last edited by Meshiest on Tue Jan 08, 2013 7:45 pm; edited 2 times in total

Meshiest
Blocklandian

Posts : 68
Join date : 2013-01-02
Age : 20
Location : The Internet

View user profile http://marblemodz.forumotion.com

Back to top Go down

Re: Text Colors...

Post  Innocent on Tue Jan 08, 2013 6:59 pm

Perfectly good ^^ :P Didn't want to tell all the things about the hex field but.. okay xD
avatar
Innocent
Blocklandian

Posts : 17
Join date : 2012-12-31
Age : 21
Location : Montreal

View user profile

Back to top Go down

Re: Text Colors...

Post  Meshiest on Wed Jan 09, 2013 12:18 am

I was bored so I made an "AutoHex"
Code:
function getHexadecimal(%x)
{
   while (%x>0)
   {
      %remainder = %x % 16;
      switch(%remainder)
      {
         case 0 : %result = %remainder@%result;
         case 1 : %result = %remainder@%result;
         case 2 : %result = %remainder@%result;
         case 3 : %result = %remainder@%result;
         case 4 : %result = %remainder@%result;
         case 5 : %result = %remainder@%result;
         case 6 : %result = %remainder@%result;
         case 7 : %result = %remainder@%result;
         case 8 : %result = %remainder@%result;
         case 9 : %result = %remainder@%result;
         case 10 : %result = "A"@%result;
         case 11 : %result = "B"@%result;
         case 12 : %result = "C"@%result;
         case 13 : %result = "D"@%result;
         case 14 : %result = "E"@%result;
         case 15 : %result = "F"@%result;
      }
      %x = %x/16;
   }
   return %result;
}

Basically, this makes it so you can use getHexadecimal(NUMBER);
It returns the hexdecimal of number Razz

Meshiest
Blocklandian

Posts : 68
Join date : 2013-01-02
Age : 20
Location : The Internet

View user profile http://marblemodz.forumotion.com

Back to top Go down

Re: Text Colors...

Post  Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum