I don't see how this will matter much, but here is the subroutine (including all the spammy codes array, best viewed in fixed width font with no word wrap):
sub doRainbow {
my(@codes)=(
'~BK~FR','~BK~FG','~BK~FY','~BK~FB','~BK~FM','~BK~FT','~BK~FW',
'~BK~OL~FR','~BK~OL~FG','~BK~OL~FY','~BK~OL~FB','~BK~OL~FM','~BK~OL~FT','~BK~OL~FW','~BK~OL~FK',
# '~BR~FG','~BR~FY','~BR~FB','~BR~FM','~BR~FT','~BR~FW','~BR~FK',
# '~BR~OL~FG','~BR~OL~FY','~BR~OL~FB','~BR~OL~FM','~BR~OL~FT','~BR~OL~FW','~BR~OL~FK',
'~BG~FR', '~BG~FB','~BG~FM', '~BG~FW','~BG~FK',
'~BG~OL~FR', '~BG~OL~FY','~BG~OL~FB','~BG~OL~FM','~BG~OL~FT','~BG~OL~FW',
# '~BY~FR','~BY~FG', '~BY~FB','~BY~FM','~BY~FT','~BY~FW','~BY~FK',
# '~BY~OL~FR','~BY~OL~FG', '~BY~OL~FB','~BY~OL~FM','~BY~OL~FT','~BY~OL~FW','~BY~OL~FK',
'~BB~FR','~BB~FG','~BB~FY', '~BB~FM','~BB~FT','~BB~FW','~BB~FK',
'~BB~OL~FR','~BB~OL~FG','~BB~OL~FY', '~BB~OL~FM','~BB~OL~FT','~BB~OL~FW','~BB~OL~FK',
# '~BM~FR','~BM~FG','~BM~FY','~BM~FB', '~BM~FT','~BM~FW','~BM~FK',
# '~BM~OL~FR','~BM~OL~FG','~BM~OL~FY','~BM~OL~FB', '~BM~OL~FT','~BM~OL~FW','~BM~OL~FK',
# '~BT~FR','~BT~FG','~BT~FY','~BT~FB','~BT~FM', '~BT~FW','~BT~FK',
# '~BT~OL~FR','~BT~OL~FG','~BT~OL~FY','~BT~OL~FB','~BT~OL~FM', '~BT~OL~FW','~BT~OL~FK',
# '~BW~FR','~BW~FG','~BW~FY','~BW~FB','~BW~FM','~BW~FT', '~BW~FK',
# '~BW~OL~FR','~BW~OL~FG','~BW~OL~FY','~BW~OL~FB','~BW~OL~FM','~BW~OL~FT', '~BW~OL~FK',
'*');
my(@done)=(0);
my($n,$r,$alldone,$out)=(0,0,0,'');
for ($n=0; $n<$#codes; $n++) { $done[$n]=0; }
my($word)=@{$_[2]}[0];
chomp($word);
srand;
until ($alldone) {
#$r=(int(qx(c:/bin/rnd $#codes)));
$r=(int(rand($#codes))); # <-- This line!
if (!$done[$r]) {
$done[$r]=1;
$out.="$codes[$r]$word\~RS";
}
$alldone=1 if (join('',@done) !~ m/0/g);
}
$world->send($out);
}
The line marked with <-- This line! is what causes the error. The line above that calls c:/bin/rnd is the external script (as a .BAT file) that uses the same rand() function. If I use rand() inside a MUclient script, MUclient throws an error. If I use it externally, the subroutine takes forever to process but does complete successfully. |