Rainbow Text

By Scarheart33 on Feb 20, 2012

This is a code I found here. I can't remember the original creator, but I made some changes. It gives a ROYGBIV pattern and turning the background on gives it a black background, to see the colors better. I have now fixed the color problem :)

on *:input:#: {
  if (%rainbowtexton) && (!$istok(! $chr(47),$left($1,1),32)) {
    var %r1 1
    var %rainbownupt 1
    var %nintext $len($1-) + 1
    var %rainboworder 04,07,08,09,11,12,06
    while (%r1 < %nintext) {
      if ($mid($1-,%r1,1) != $chr(32)) { var %msgrbw $addtok(%msgrbw,$gettok(%rainboworder,%rainbownupt,44) $+ $mid($1-,%r1,1),0) | inc %rainbownupt $iif(%rainbownupt = 7,-6,1) }
      else { var %msgrbw %msgrbw $chr(32) }
      inc %r1
    }
    say %msgrbw
    haltdef
  }
  elseif (%rainbowtextandbackgroundon) && (!$istok(! $chr(47),$left($1,1),32)) {
    var %r1 1
    var %rainbownupt 1
    var %nintext $len($1-) + 1
    var %rainboworder 04,01.07,01.08,01.09,01.11,01.12,01.06,01
    while (%r1 < %nintext) {
      if ($mid($1-,%r1,1) != $chr(32)) { var %msgrbw $addtok(%msgrbw,$gettok(%rainboworder,%rainbownupt,46) $+ $mid($1-,%r1,1),0) }
      else { var %msgrbw %msgrbw $+ $gettok(%rainboworder,%rainbownupt,46) $chr(32) }
      inc %r1
      inc %rainbownupt $iif(%rainbownupt = 7,-6,1)
    }
    say %msgrbw
    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.
Abcdefmonkey   -  Mar 05, 2012

@Zohaib make sure you're using haltdef.

 Respond  
Scarheart33   -  Mar 05, 2012

Thanks @napa182 and Wader I didn't see that before :)

 Respond  
Zohaib   -  Feb 25, 2012

it writes two lines when i try to chat on main like this:

[21:31:18] <@Zohaib> HOW ARE YOU
[21:31:18] <@Zohaib> 04H07O08W09 11A12R02E06 13Y04O07U

 Respond  
Abcdefmonkey   -  Feb 24, 2012

Here's an easier way... it's what I use that I made.. I threw in my reverse text and reverse rainbow text.. for no reason honestly..

Alias:

nextcolor { 
  if ($$1 == 04) return 07
  elseif ($$1 == 07) return 08
  elseif ($$1 == 08) return 09
  elseif ($$1 == 09) return 11
  elseif ($$1 == 11) return 12
  elseif ($$1 == 12) return 02
  elseif ($$1 == 02) return 06
  elseif ($$1 == 06) return 13
  elseif ($$1 == 13) return 04
}
rainbow {
  var %pos = 1, %color = 04, %result = $chr(3)
  while (%pos <= $len($1-)) {
    %result = %result $+ %color $+ $mid($1-,%pos,1) $+ $chr(3)
    inc %pos
    %color = $nextcolor(%color)
  }
  if ($isid) return %result
  else say %result
}

rev {
  var %len = $len($1-)
  var %return = $null
  while (%len > 0) {
    var %return = %return $+ $mid($1-,%len,1) $+ $chr(32)
    dec %len
  }
  return %return
}

Input:

menu channel,status,nicklist {
  Default Output
  .Rainbow
  ..On: set %rbow true | set %reverse false | set %rainverse false | echo 9 Rainbow text is now enabled
  ..Off: set %rbow false | echo 4 Rainbow text is now disabled
  .Reverse
  ..On: set %reverse true | set %rbow false | set %rainverse false | echo 9 Reverse text is now enabled
  ..Off: set %reverse false | echo 4 Reverse text is now disabled
  .Both
  ..On: set %rainverse true | set %rbow false | set %reverse false | echo 9 Both options are now enabled
  ..Off: set %rainverse false | echo 4 Both options are now disabled
}
on *:INPUT:#:{
  if ($left($1,1) != /) {
        msg $active $iif(%rbow == true,$rainbow($1-),$iif(%reverse == true,$rev($1-),$iif(%rainverse == true,$rainbow($rev($1-)),$1-)))
haltdef
  }
}

Just my input.. I had to strip it down heavily due to a custom theme.. but I tested this and it worked as far as what it's intended for.. :S I know this could be shortened and what not, but it's just something I made long ago and I just haven't felt the need to shorten it. Anyways, hope this helps someone.

 Respond  
SalvadorCampos   -  Feb 24, 2012
  • Formato no válido: $addtok (línea 9, script12.ini)
  • Formato no válido: $addtok (línea 22, script12.ini)
 Respond  
Wade   -  Feb 20, 2012

What napa said.

However you should easily be able to fix that by using 2 digit colour codes.

i.e: 4 becomes 04. 7 becomes 07, etc.

 Respond  
napa182   -  Feb 20, 2012

it makes the numbers disappear cuz it's trying to read them as color codes.

 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.