rendered paste body#!/usr/bin/perl
Xchat::register("Rainbow Text", "1.1", "Rainbow Text script; usage: /rainbow <whatever text you want>");
Xchat::hook_command("rainbow", "rainbow_sub");
sub rainbow_sub {
$text = "";
@colors = ("05", "04", "07", "08", "09", "03", "11", "10", "12", "02", "06", "13", "15", "14");
$colorlen = scalar @colors;
$colornum = int(rand($colorlen-1));
$line = $_[1][1];
foreach $letter (split('', $line)) {
if ($letter =~ /\s/) {
$text .= "$letter";
} else {
$text .= "\cC$colors[$colornum++]$letter";
}
if ($colornum > ($colorlen - 1)) {
$colornum = 0;
}
}
Xchat::command("say $text");
return 1;
}