Rainbow colors

By Rider91 on Jun 05, 2011

this is an edit of another script basically the same, works perfectly all options in the right click menu under Rainbow,

its an edit of this script: http://www.hawkee.com/snippet/2727/

its easier to read with and without the backround

on *:INPUT:*:{
  if (%rainbowtexton == 1) && ($left($1,1) != /) {
    var %r1 1
    var %nintext $len($1-) + 1
    while (%r1 < %nintext) {
      if ($mid($1-,%r1,1) != $chr(32)) { var %msgrbw $addtok(%msgrbw,04 $+ $mid($1-,%r1,1),0) }
      else { var %msgrbw %msgrbw $chr(32) }
      inc %r1

      if ($mid($1-,%r1,1) != $chr(32)) { var %msgrbw $addtok(%msgrbw,07 $+ $mid($1-,%r1,1),0) }
      else { var %msgrbw %msgrbw $chr(32) }
      inc %r1

      if ($mid($1-,%r1,1) != $chr(32)) { var %msgrbw $addtok(%msgrbw,13 $+ $mid($1-,%r1,1),0) }
      else { var %msgrbw %msgrbw $chr(32) }
      inc %r1

      if ($mid($1-,%r1,1) != $chr(32)) { var %msgrbw $addtok(%msgrbw,09 $+ $mid($1-,%r1,1),0) }
      else { var %msgrbw %msgrbw $chr(32) }
      inc %r1

      if ($mid($1-,%r1,1) != $chr(32)) { var %msgrbw $addtok(%msgrbw,12 $+ $mid($1-,%r1,1),0) }
      else { var %msgrbw %msgrbw $chr(32) }
      inc %r1

      if ($mid($1-,%r1,1) != $chr(32)) { var %msgrbw $addtok(%msgrbw,06 $+ $mid($1-,%r1,1),0) }
      else { var %msgrbw %msgrbw $chr(32) }
      inc %r1

      if ($mid($1-,%r1,1) != $chr(32)) { var %msgrbw $addtok(%msgrbw,13 $+ $mid($1-,%r1,1),0) }
      else { var %msgrbw %msgrbw $chr(32) }
      inc %r1
    }
    say %msgrbw
    haltdef
  }

  elseif (%rainbowtextandbackgroundon == 1)  && ($left($1,1) != /) {
    var %r2 1
    var %nintext2 $len($1-) + 1
    while (%r2 < %nintext2) {

      if ($mid($1-,%r2,1) != $chr(32)) { var %msgrbw2 $addtok(%msgrbw2,04 $+ $chr(44) $+ 01 $+ $mid($1-,%r2,1),0) }
      else { var %msgrbw2 %msgrbw2 $+ 6,01 $chr(32) }
      inc %r2

      if ($mid($1-,%r2,1) != $chr(32)) { var %msgrbw2 $addtok(%msgrbw2,07 $+ $chr(44) $+ 01 $+ $mid($1-,%r2,1),0) }
      else { var %msgrbw2 %msgrbw2 $+ 13,01 $chr(32) }
      inc %r2

      if ($mid($1-,%r2,1) != $chr(32)) { var %msgrbw2 $addtok(%msgrbw2,13 $+ $chr(44) $+ 01 $+ $mid($1-,%r2,1),0) }
      else { var %msgrbw2 %msgrbw2 $+ 12,01 $chr(32) }
      inc %r2

      if ($mid($1-,%r2,1) != $chr(32)) { var %msgrbw2 $addtok(%msgrbw2,9 $+ $chr(44) $+ 01 $+ $mid($1-,%r2,1),0) }
      else { var %msgrbw2 %msgrbw2 $+ 3,01 $chr(32) }
      inc %r2

      if ($mid($1-,%r2,1) != $chr(32)) { var %msgrbw2 $addtok(%msgrbw2,11 $+ $chr(44) $+ 01 $+ $mid($1-,%r2,1),0) }
      else { var %msgrbw2 %msgrbw2 $+ 8,01 $chr(32) }
      inc %r2

      if ($mid($1-,%r2,1) != $chr(32)) { var %msgrbw2 $addtok(%msgrbw2,8 $+ $chr(44) $+ 01 $+ $mid($1-,%r2,1),0) }
      else { var %msgrbw2 %msgrbw2 $+ 7,01 $chr(32) }
      inc %r2

      if ($mid($1-,%r2,1) != $chr(32)) { var %msgrbw2 $addtok(%msgrbw2,0 $+ $chr(44) $+ 01 $+ $mid($1-,%r2,1),0) }
      else { var %msgrbw2 %msgrbw2 $+ 4,01 $chr(32) }
      inc %r2
    }
    say %msgrbw2
    haltdef
  }

}

menu channel {
  Rainbow
  .text On:{
    unset %rainbowtextandbackgroundon
    set %rainbowtexton 1
    ;echo -a Rainbow text turned on
  }
  .text + background On:{
    unset %rainbowtexton
    set %rainbowtextandbackgroundon 1
    ;echo -a Rainbow text and background colour turned on
  }
  .Colour Off:{
    unset %rainbowtexton
    unset %rainbowtextandbackgroundon
    ;echo -a Rainbow text, and Rainbow text with background colour turned off
  }
  -

Comments

Sign in to comment.
napalm`   -  Jul 01, 2011

Also, reference my post from 2008.

http://www.hawkee.com/snippet/5063/

 Respond  
napalm`   -  Jul 01, 2011
alias rx { 
  :redo | var %x $r(2,15) , %y $r(2,15)
  if (%x = %y) goto redo
  if ($1) return $+(,%x,$chr(44),%y,)
  else return $+(,%x,)
}
alias rc return $regsubex($1-,/(.)/g,$+($iif($prop,$rx(1),$rx),\1))

Useage:
//echo -a $rc(This is a test 12345) <- Random color no background color.
//echo -a $rc(This is a test 12345).whatever <- Random color + Random bkg color.

 Respond  
CrazyShady   -  Jul 01, 2011

I have no problem with this script. It doesn't come up twice for me.

 Respond  
napa182   -  Jun 29, 2011

To add what Jethro_ said about $regsubex you can play around with this

alias color say $regsubex($1-,/(.)/g,$+($chr(3),$base($r(2,15),10,10,2),\t))

also to the others that this is saying it twice, you may have another on input event on while you are trying to run this snippet. as well he is missing a closing bracket.

 Respond  
hxck   -  Jun 29, 2011

I don't have another color script, and it did it to me.

 Respond  
CrazyShady   -  Jun 28, 2011

I've had this one before. And the only way it will do double is if you have another color script turned on

 Respond  
FreeHuman   -  Jun 23, 2011

Good Code.But Have 1 Problem.it doing double text

 Respond  
chachin   -  Jun 21, 2011

yes its doing it double.. only script i have is one for auto-Ident-auto-Ghost

 Respond  
Jethro   -  Jun 07, 2011

This snippet looks rather repetitive, bulky to me. This could've been done a lot shorter with $regsubex(), but then not everybody knows regex. There has to be a more effective way to code a script like this.

 Respond  
Rider91   -  Jun 06, 2011

works perfectly fine for me, no double text, there might be a conflict with another script on yours

 Respond  
hxck   -  Jun 06, 2011

You missed a brace at the very end. Also, it posts the text twice, colored and not colored. Maybe you should should shun the first one?

 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.