All pastes #12497 Raw Edit

Something

public text v1 · immutable
#12497 ·published 2005-05-24 06:36 UTC
rendered paste body
;Function to randomize the colors of each letter in a string
;  $1- The text to color

;
;  Return: The string with the colors randomized
/colors {
  var %temp = 1, %max = $len($1-), %char, %string, %color = 3 4 6 7 8 9 11 12 13, %cstemp = 0, %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
    %cstemp = %cs 
    while (%cstemp == %cs) {
      %cs = $rand(1,$numtok(%color,32))
    }
  }

  %string =  $+ $rand(0,15) $+ %string

  if ($isid) {
    return %string
  }
  else {
    msg # %string
  }
}