Random Color Generator

By SoxFarxAway777 on Aug 23, 2008

This snippet is pretty much pointless, and was just a way to pass the time. What it does is randomly picks a color, and applies that color to the specified text.

on *:TEXT:-Color *:#: {
  var %color $rand(0,14)
  if (%color == 0) { /msg $chan 0 $2- }
  if (%color == 1) { /msg $chan 1 $2- }
  if (%color == 2) { /msg $chan 2 $2- }
  if (%color == 3) { /msg $chan 3 $2- }
  if (%color == 4) { /msg $chan 4 $2- }
  if (%color == 5) { /msg $chan 5 $2- }
  if (%color == 6) { /msg $chan 6 $2- }
  if (%color == 7) { /msg $chan 7 $2- }
  if (%color == 8) { /msg $chan 8 $2- }
  if (%color == 9) { /msg $chan 9 $2- }
  if (%color == 10) { /msg $chan 10 $2- }
  if (%color == 11) { /msg $chan 11 $2- }
  if (%color == 12) { /msg $chan 12 $2- }
  if (%color == 13) { /msg $chan 13 $2- }
  if (%color == 14) { /msg $chan 14 $2- }
}

Comments

Sign in to comment.
AYEHAN   -  Sep 23, 2011

Jethro thanks for the answer i tried this but not working

actually i wanna use it in GTSdll setting pannel where it shows bittorrent details

i want it to show every file name in new(random) color and that box uses veriable like

[file] [size] [uped] [dned] so i want a veriable so i put it in that box

on :text::#: { var %color bla bla bla

something like thats am not coder so i might give u a wrong example but a code like this that setup a variable whenever my script type and it will be used

 Respond  
Jethro   -  Sep 23, 2011

AYEHAN, in each msg bit, change them to:

/msg $chan $+($chr(3),$rand(0,15),$2-)

Then you will have a random color output every time.

 Respond  
AYEHAN   -  Sep 23, 2011

it's a real old post but still ....

is there a way i can put a veriable somewhere so that text could be random colour

 Respond  
Typo   -  Aug 23, 2008

For starters the colors go from 0-15 not 0-14 as you have it, you do not need to use /'s inside of scripts, you should include a background color as well and check that they dont match so you can make sure someone never ends up with white on white for instance, and also this whole thing could be shortened to a few lines even with the additional checks for matching colors and whatnot. Your code:

on *:TEXT:-Color *:#: { msg #  $+ $r(0-15) $1-
  var %color $rand(0,14)
  if (%color == 0) { /msg $chan 0 $2- }
  if (%color == 1) { /msg $chan 1 $2- }
  if (%color == 2) { /msg $chan 2 $2- }
  if (%color == 3) { /msg $chan 3 $2- }
  if (%color == 4) { /msg $chan 4 $2- }
  if (%color == 5) { /msg $chan 5 $2- }
  if (%color == 6) { /msg $chan 6 $2- }
  if (%color == 7) { /msg $chan 7 $2- }
  if (%color == 8) { /msg $chan 8 $2- }
  if (%color == 9) { /msg $chan 9 $2- }
  if (%color == 10) { /msg $chan 10 $2- }
  if (%color == 11) { /msg $chan 11 $2- }
  if (%color == 12) { /msg $chan 12 $2- }
  if (%color == 13) { /msg $chan 13 $2- }
  if (%color == 14) { /msg $chan 14 $2- }
}

And the edited code is:

On *:Text:-color *:#:{ 
  :start
  if ($r(0,15) != $r(0,15)) { msg #  $+ $v1 $+ , $+ $v2 $2- }
  else { goto start }
}

I would also change the introduction to make it clear that this is for other peoples text and not your own, it's a bit misleading.

Keep in mind that the way you had it there would be a colored space at the beginning of every line due to the lack of a $+ between the color and text but then you also have to make sure the numbers are in a double digit (00 or 01 instead of 0 or 1) format so that if the following text is numbers, it wouldnt affect the color and also, just like your code, mine has no flood/abuse protection because I wanted to leave you something to do.

 Respond  
SweeTCooL   -  Aug 23, 2008

Hmmm i think that snippet Can work For Bot only that what u mean ?

-color lol 5 lol
 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.