Rainbow Text

By GoldFish on Sep 17, 2013

Rainbow script made by me! Rainbow text is toggled using F1. The script also uses rainbow as an identifier so this allows for the use of $rainbow in other scripts

on *:input:*: {
  if (%rainbow == on && !$regex($1,/^[/\.~!]/)) {
    haltdef
    msg $active $rainbow($1-)
  }
  elseif (%rainbow == on && $1 == /me) {
    haltdef
    describe $active $rainbow($2-)
  }
}
alias rainbow {
  var %string $1-
  var %count 0
  var %color 1
  while (%count < $len($1-)) {
    var %color2 $gettok(04.07.08.09.03.12.06,%color,46)
    var %output %output $+ $iif($left(%string,1) != $chr(32), $+ $iif($left(%string,1) isnum,%color2,$remove(%color2,0)) $+ $iif(%output,$null,$chr(44) $+ 01) $+ $left(%string,1),$chr(32) $+ $chr(32))
    if ($left(%string,1) != $chr(32)) var %color $iif(%color == 7,1,$calc(%color + 1))
    var %string $right(%string,-1)
    inc %count
  }
  return %output $+ 
}
alias F1 {
  $iif(%rainbow == on,unset %rainbow,set %rainbow on)
  echo -a $iif(%rainbow == on,$rainbow(~~~~~~~),~~~~~~~)
}

Comments

Sign in to comment.
SReject   -  Oct 07, 2013
alias rainbow return $regsubex($1-,/(\S)/g,$chr(3) $+ $gettok(04.07.08.09.03.12.06,$calc((\n -1)%7+1),46) $+ \1)
MaSOuD  -  Oct 07, 2013
Stop bragging with your RegEx stuff :D
SReject  -  Oct 08, 2013

Be that way Masoud:

alias rainbow return $regsubex($1-,/(?=\S)/g,$chr(3) $+ $gettok(04.07.08.09.03.12.06,$calc((\n -1)% 7+1),46))

This could also be shortened by replacing "$chr(3) " with the actual character, but hawkee/websites don't like displaying it.

Sign in to comment

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.