All pastes #735855 Raw Edit

Colors!

public text v1 · immutable
·published 2007-10-14 00:43 UTC
rendered paste body
color {
  var %temp = 1, %max = $len($1-), %char, %string, %color = 4 7 8 3 12 6, %cs = $rand(1,$numtok(%color,32))
  while (%temp <= %max) {
    %char = $mid($1-,%temp,1) | if (%char isnum) %string = %string $+  $+ $gettok(%color,%cs,32) $+ ,99 $+ %char
    elseif (%char = $chr(32)) { inc %temp | %char = $mid($1-,%temp,1) | %string = %string  $+ $gettok(%color,%cs,32) $+ %char }
    else { %string = %string $+  $+ $gettok(%color,%cs,32) $+ %char }
    inc %temp | inc %cs | if (%cs > $numtok(%color,32)) %cs = 1
  }
  if ($isid) return %string | else msg # %string
}

color2 {
  var %temp = 1, %max = $len($1-), %char, %string, %color = 2 4 10 3 12 6, %cs = $rand(1,$numtok(%color,32))
  while (%temp <= %max) {
    %char = $mid($1-,%temp,1) | if (%char isnum) %string = %string $+  $+ $gettok(%color,%cs,32) $+ ,99 $+ %char
    elseif (%char = $chr(32)) { inc %temp | %char = $mid($1-,%temp,1) | %string = %string  $+ $gettok(%color,%cs,32) $+ %char }
    else { %string = %string $+  $+ $gettok(%color,%cs,32) $+ %char }
    inc %temp | inc %cs | if (%cs > $numtok(%color,32)) %cs = 1
  }
  if ($isid) return %string | else msg # %string
}

colorc {
  var %temp = 1, %max = $len($1-), %char, %string, %color = 4 3, %cs = $rand(1,$numtok(%color,32))
  while (%temp <= %max) {
    %char = $mid($1-,%temp,1) | if (%char isnum) %string = %string $+  $+ $gettok(%color,%cs,32) $+ ,99 $+ %char
    elseif (%char = $chr(32)) { inc %temp | %char = $mid($1-,%temp,1) | %string = %string  $+ $gettok(%color,%cs,32) $+ %char }
    else { %string = %string $+  $+ $gettok(%color,%cs,32) $+ %char }
    inc %temp | inc %cs | if (%cs > $numtok(%color,32)) %cs = 1
  }
  if ($isid) return %string | else msg # %string
}
color5 {
  var %temp = 1, %max = $len($1-), %char, %string, %color = 1 2 3 4 5 6, %cs = $rand(1,$numtok(%color,32))
  while (%temp <= %max) {
    %char = $mid($1-,%temp,1) | if (%char isnum) %string = %string $+  $+ $gettok(%color,%cs,32) $+ ,99 $+ %char
    elseif (%char = $chr(32)) { inc %temp | %char = $mid($1-,%temp,1) | %string = %string  $+ $gettok(%color,%cs,32) $+ %char }
    else { %string = %string $+  $+ $gettok(%color,%cs,32) $+ %char }
    inc %temp | inc %cs | if (%cs > $numtok(%color,32)) %cs = 1
  }
  if ($isid) return %string | else msg # %string
}
color3 {
  var %temp = 1, %max = $len($1-), %char, %string, %color = 5 4 11 3 9 12 10, %cs = $rand(1,$numtok(%color,32))
  while (%temp <= %max) {
    %char = $mid($1-,%temp,1) | if (%char isnum) %string = %string $+  $+ $gettok(%color,%cs,32) $+ ,99 $+ %char
    elseif (%char = $chr(32)) { inc %temp | %char = $mid($1-,%temp,1) | %string = %string  $+ $gettok(%color,%cs,32) $+ %char }
    else { %string = %string $+  $+ $gettok(%color,%cs,32) $+ %char }
    inc %temp | inc %cs | if (%cs > $numtok(%color,32)) %cs = 1
  }
  if ($isid) return %string | else msg # %string
}
colorn3 {
  var %temp = 1, %max = $len($1-), %char, %string, %color = 5 4 11 3 9 12 10, %cs = $rand(1,$numtok(%color,32))
  while (%temp <= %max) {
    %char = $mid($1-,%temp,1) | if (%char isnum) %string = %string $+  $+ $gettok(%color,%cs,32) $+ ,99 $+ %char
    elseif (%char = $chr(32)) { inc %temp | %char = $mid($1-,%temp,1) | %string = %string  $+ $gettok(%color,%cs,32) $+ %char }
    else { %string = %string $+  $+ $gettok(%color,%cs,32) $+ %char }
    inc %temp | inc %cs | if (%cs > $numtok(%color,32)) %cs = 1
  }
  if ($isid) return %string | else notice $1 %string
}

color4 {
  var %temp = 1, %max = $len($1-), %char, %string, %color = 1 2 3 4 5 6 7 8 9 10 11 12 13, %cs = $rand(1,$numtok(%color,32))
  while (%temp <= %max) {
    %char = $mid($1-,%temp,1) | if (%char isnum) %string = %string $+  $+ $gettok(%color,%cs,32) $+ ,99 $+ %char
    elseif (%char = $chr(32)) { inc %temp | %char = $mid($1-,%temp,1) | %string = %string  $+ $gettok(%color,%cs,32) $+ %char }
    else { %string = %string $+  $+ $gettok(%color,%cs,32) $+ %char }
    inc %temp | inc %cs | if (%cs > $numtok(%color,32)) %cs = 1
  }
  if ($isid) return %string | else msg # %string
}