All pastes #373770 Raw Edit

Someone

public text v1 · immutable
#373770 ·published 2007-02-27 00:04 UTC
rendered paste body
# Roux/2gen Scramble Generator
  if (((time()-$time) >= 20 || $nick =~ /^pjgat09$/) && $target =~ /^#rubik$/i && $text =~ /^[.!](roux|2g(en)?)(\s(\d+))?/i) {
    my $type = $1;
    my $len = $4;
    if ($len > 100) { $len = 100; }
    if ($len <= 0) { $len = 16; }
    my $start = int(rand(2));
    $flag = $start;
    my ($result,$rand);
    my $chars; 
    $chars = "UM2'" if ($type =~ /roux/);
    $chars = "UR2'" if ($type =~ /2/);
    for (my $i; $i < $len; $i++) {
      $result .= substr($chars,$start,1);
      $rand = int(rand(3));
      if ($rand) {
        $result .= substr($chars,$rand+1,1);
      }
      $result .= " ";
      $start = $start ^ 1;
      $flag .= $start;
    }
    $totals[6]++ if ($type =~ /roux/);
    $totals[9]++ if ($type =~ /2/);
    $server->command("msg #rubik roux scramble #$totals[6]: $result") if ($type =~ /roux/); 
    $server->command("msg #rubik 2gen scramble #$totals[9]: $result") if ($type =~ /2/); 
    $time = time();
    save_counts();
  }