/rb and $rb - rainbow colour text

By knoeki on Jul 07, 2009

An alias and identifier in one, BONUS! ;_)

usage is simple. when you simply want to message some nice coloured text to a channel...:

/rb this is my fancy coloured message.

as an identifier:

$rb(-i, text to colourify here)

returns the text with random colours.

I know that stuff like this has been done to death, but I'll post it regardless.

Also, it requires another identifier I posted, $padnum, to make sure that you won't end up with glitches when $rand returns a single digit and there's numbers in text. thanks to WorldDMT for pointing that out, I never realized when I posted this.

yes, I also realize that it's probably slow and inefficient code, but I was bored and couldn't find a better way this quickly.

Update: it's probably better now, sort of. I guess.

alias rb {
   var %input $replacex($iif($1 == -i, $2-, $1-), $chr(32), $chr(160)), %x 1
   while (%x <= $len(%input)) {
      var %output $+(%output,$replacex($mid(%input, %x, 1),$mid(%input, %x, 1), $+(,$padnum($rand(2,15), 15),$mid(%input, %x, 1))))
      inc %x
   }
   $iif($1 == -i, return %output, say %output)
}

Comments

Sign in to comment.
The6PuffPack   -  Feb 11, 2012

.. THIS PLAYS MY MUSIC.

 Respond  
knoeki   -  Jul 09, 2009

argh, I should have mention. custom alias of mine, I posted it here on hawkee as well. makes sure that if $rand() returns a single digit, it will add a 0 to the start, so that things won't mix up when text contains any numbers.

I've updated the alias and the description, wanted to do this and then saw your comment :_)

 Respond  
WorldDMT   -  Jul 09, 2009

what the alias $padnum??

 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.