Xchat::register("Test","0.1"); Xchat::hook_server("PRIVMSG",\&test_sub); sub test_sub { if ($_[0][2] eq "#testing123" && $_[0][3] eq ":!3") { $chars = "UDFBLR2'"; #my %check = ("0" => "1", "1" => "0", "2" => "3", "3" => "2", "4" => "5", "5" => "4"); my @check = (1, 0, 3, 2, 5, 4); my $result; for (my $i; $i < 26; $i++) { $rand = int(rand(6)); while ($rand == $a || ($rand == $b && $check{$rand} == $a)) { $rand = int(rand(6)); } $b = $a; $a = $rand; $result .= substr($chars,$rand,1) . " "; #$rand = int(rand( } Xchat::command("msg #testing123 $result"); } return Xchat::EAT_NONE; }