UNO v3.1 — File Browser

UNOv3.1v3.1 / UNOv3.1v3.1 / UNO.mrc

UNO.mrc — 42.96 KB — Download this file

on *:LOAD:{
  echo 8UNO14 v3.1 by poiuy_qwert loaded! Type /run $+(",$scriptdirsettings.ini,") to change your settings!
  window -pCfdBoh +dL @UNO 1 1 250 200 @UNO
  drawrect -rnf @UNO 0 1 0 0 250 200
  drawrect -rn @UNO $rgb(255,255,255) 1 1 1 248 198
  var %a 1
  while %a < 11 {
    drawtext -ron @UNO $rgb(200,200,0) Tahoma 100 $calc(15-%a) %a UNO
    inc %a
  }
  drawtext -ron @UNO $rgb(255,255,0) Tahoma 100 15 0 UNO
  drawtext -rn @UNO $rgb(255,255,0) Tahoma 12 73 160 v3.1 by poiuy_qwert
  drawtext -rn @UNO $rgb(200,200,200) Tahoma 12 45 180 (Right-click for more options)
  drawdot @UNO
  window -wa @UNO
}
menu @UNO {
  Open Readme:run $+(",$scriptdirreadme.html")
  Open Settings:run notepad $+(",$scriptdirsettings.ini")
  Close Splash:window -c @UNO
}
on *:KEYUP:@UNO:13,27:if ($keyval == 13) && (!%enter) inc %enter | else { window -c @UNO | unset %enter }
on *:CONNECT:if ((!$uno.set(networks)) || ($istok($uno.set(networks),$network,32))) && ($uno.set(autojoin)) join $replace($regsubex($regsubex($uno.set(channel),$+(/\b,$network,:\B),),/\b[^\s:]+:#\S+\b/g,),$chr(32),$chr(44))
on *:DISCONNECT:if ((!$uno.set(networks)) || ($istok($uno.set(networks),$network,32))) { .hfree -w uno* | .timerunospam off | if ($window(@unomsgs)) window -c @unomsgs }
on *:JOIN:$uno.set(channel):if ($nick == $me) { %unoial = 1 | .who $chan }
raw *:*:{
  if ($istok(315 352,$numeric,32)) && (!%unoial) {
    if ($numeric == 352) unset %unoial
    halt
  }
}
on *:TEXT:*:#:{
  if ($regex(. $uno.set(channel) .,$+(/\s,$chr(40),?:,$network,:,$chr(41),?,$chan,\s/i))) {
    if ($1- == ?trigger) msg $chan My current trigger is: $uno.set(trigger)
    else {
      if (($uno.set(needtrigger)) && ($left($1,1) != $uno.set(trigger))) || ((!$uno.set(needtrigger)) && (!$istok(on jo join bo botjoin stop le leave bl botleave st start ca cards tu turns pl play dr draw pa pass uno shuffle replace botreplace off help trigger addadmin deladmin suspend unsuspend score records elapsed played top,$iif($left($1,1) != $uno.set(trigger),$1,$right($1,-1)),32))) return
      if ($uno.set(spamcmds) > 0) {
        hinc -mu [ $+ [ $uno.set(spamcmdtime) ] ] unospam $wildsite 1
        if ($hget(unospam,$wildsite) > $uno.set(spamcmds)) return
      }
      if (*m* iswmcs $chan($chan).mode) && ($me isreg $chan) && ($uno.set(moderror)) { uno.msg $nick 7UNO14 can't be played with mode +m on unless the bot is voiced or opped. | return }
      uno.cmd $chan $nick $iif($left($1,1) == $uno.set(trigger),$right($1-,-1),$1-)
    }
  }
}
alias uno.cmd {
  var %chan $1,%nick $2,%wildsite $address($2,2)
  tokenize 32 $3-
  if ($1 == on) {
    if ($uno.access($1,%nick,%chan)) uno.msg %chan You must be $v1 to use that command.
    elseif (!$uno.hash(on)) {
      hadd -m uno on 1
      uno.msg %chan 8UNO14 is now on! Type $uno.set(trigger) $+ join to join the game.
    }
    else uno.msg %chan 8UNO14 is already on.
  }
  elseif ($istok(jo join,$1,32)) {
    if ($uno.access(join,%nick,%chan)) uno.msg %chan You must be $v1 to use that command.
    elseif ($istok($uno.hash(names),%nick,32)) uno.msg %chan You are already in the game.
    elseif ($uno.hash(players) == 10) uno.msg %chan The game is already full.
    elseif ($uno.hash(on) > 1) uno.msg %chan You can't join the game after it has started. Type  $uno.set(trigger) $+ replace to be put on the waiting list to replace players that leave.
    elseif (!$uno.hash(on)) uno.msg %chan You have to turn 8UNO14 on to join the game. Type  $uno.set(trigger) $+ on to turn 8UNO14 on.
    else {
      hinc uno players 1
      hadd uno names $uno.hash(names) %nick
      uno.msg %chan  $+ %nick has joined the game. $iif($uno.hash(players) > 1,Type $uno.set(trigger) $+ start to begin the game.)
    }
  }
  elseif ($istok(bo botjoin,$1,32)) {
    if ($uno.access(botjoin,%nick,%chan)) uno.msg %chan You must be $v1 to use that command.
    elseif ($istok($uno.hash(names),$me,32)) uno.msg %chan I'm already in the game.
    elseif ($uno.hash(players) == 10) uno.msg %chan The game is already full.
    elseif ($uno.hash(on) > 1) uno.msg %chan I can't join the game after it has started. Type  $uno.set(trigger) $+ botreplace to put me on the waiting list to replace players that leave.
    elseif (!$uno.hash(on)) uno.msg %chan You have to turn 8UNO14 on for me to join the game. Type  $uno.set(trigger) $+ on to turn 8UNO14 on.
    else {
      hinc uno players 1
      hadd uno names $uno.hash(names) $me
      uno.msg %chan I have joined the game. $iif($uno.hash(players) > 1,Type $uno.set(trigger) $+ start to begin the game.)
    }
  }
  elseif ($istok(le leave,$1,32)) {
    if (!$uno.hash(on)) uno.msg %chan You can't leave at this time.
    elseif (!$istok($uno.hash(names),%nick,32)) uno.msg %chan You arn't in the game.
    else uno.left %chan %nick
  }
  elseif ($istok(bl botleave,$1,32)) {
    if ($uno.access(botjoin,%nick,%chan)) uno.msg %chan You must be $v1 to use that command.
    elseif (!$uno.hash(on)) uno.msg %chan I can't leave at this time.
    elseif (!$istok($uno.hash(names),$me,32)) uno.msg %chan I'm not in the game.
    else uno.left %chan $me
  }
  elseif ($istok(st start,$1,32)) {
    if ($uno.access(start,%nick,%chan)) uno.msg %chan You must be $v1 to use that command.
    elseif ($uno.hash(on) != 1) uno.msg %chan You can't start the game at this time.
    elseif ($uno.hash(players) < 2) uno.msg %chan You must have at least 2 players to play.
    elseif (!$istok($uno.hash(names),%nick,32)) uno.msg %chan You can't start the game if you are not in it.
    else {
      uno.msg %chan The uno game has begun!
      hinc uno on 1
      var %a 1,%cards B0 B1 B1 B2 B2 B3 B3 B4 B4 B5 B5 B6 B6 B7 B7 B8 B8 B9 B9 G0 G1 G1 G2 G2 G3 G3 G4 G4 G5 G5 G6 G6 G7 G7 G8 G8 G9 G9 R0 R1 R1 R2 R2 R3 R3 R4 R4 R5 R5 R6 R6 R7 R7 R8 R8 R9 R9 Y0 Y1 Y1 Y2 Y2 Y3 Y3 Y4 Y4 Y5 Y5 Y6 Y6 Y7 Y7 Y8 Y8 Y9 Y9 BD2 BD2 GD2 GD2 RD2 RD2 YD2 YD2 BR BR GR GR RR RR YR YR BS BS GS GS RS RS YS YS W W W W WD4 WD4 WD4 WD4
      while %a <= $uno.hash(players) {
        var %b 1,%c,%p = $gettok($uno.hash(names),%a,32)
        hadd uno played. $+ %p 0
        while %b < 8 {
          var %c $gettok(%cards,$r(1,$gettok(%cards,0,32)),32),%cards = $remtok(%cards,%c,1,32)
          hadd uno %p $uno.hash(%p) %c
          inc %b
        }
        uno.msg %p Cards: $uno.cards($uno.hash(%p)).sort
        inc %a
      }
      var %c $gettok(%cards,$r(1,$gettok(%cards,0,32)),32)
      while (($len(%c) != 2) || ($right(%c,1) !isnum)) %c = $gettok(%cards,$r(1,$gettok(%cards,0,32)),32)
      %cards = $remtok(%cards,%c,1,32)
      hadd uno cardsplayed 0
      hadd uno played %c
      hadd uno top %c
      hadd uno deck %cards
      hadd uno turn $r(1,$uno.hash(players))
      hadd uno order 1
      hadd uno started $ctime
      uno.msg %chan  $+ $gettok($uno.hash(names),$uno.hash(turn),32) $+ 's turn with $gettok($uno.hash($gettok($uno.hash(names),$uno.hash(turn),32)),0,32) cards. Playing on: $uno.cards($uno.hash(top))
    }
  }
  elseif ($1 == stop) {
    if ($uno.access(stop,%nick,%chan)) uno.msg %chan You must be $v1 to use that command.
    elseif ($uno.hash(on) !isnum 2-) uno.msg %chan There is no game to stop at this time.
    else {
      hdel -w uno *
      hadd uno on 1
      uno.msg %chan The current 8UNO14 game has been stopped! Type $uno.set(trigger) $+ join to join a new game!
    }
  }
  elseif ($istok(ca cards,$1,32)) {
    if ($uno.hash(on) !isnum 2-4) uno.msg %chan The game hasn't started so you can't have any cards.
    elseif (!$istok($uno.hash(names),%nick,32)) uno.msg %chan You arn't in this game.
    else {
      var %a 1,%m Current Card: $uno.cards($uno.hash(top)) Your Cards: $uno.cards($uno.hash(%nick)).sort Cards left for
      while ($gettok($uno.hash(names),%a,32)) {
        %m = %m $+(,$v1,:) $token($uno.hash($v1),0,32) $+ 
        if ($len(%m) > 500) { uno.msg %nick %m | %m = }
        inc %a
      }
      if (%m) uno.msg %nick %m
    }
  }
  elseif ($istok(tu turn,$1,32)) {
    if ($uno.hash(on) !isnum 2-4) uno.msg %chan You can't do that at this time.
    else uno.msg %chan Current Turn: $gettok($uno.hash(names),$uno.hash(turn),32) Direction: $iif($uno.hash(order),Right,Left) Players: $replace($uno.hash(names),$chr(32),$chr(44) $+ $chr(32)) Next Turn: $gettok($uno.hash(names),$iif($uno.hash(order),$iif($calc($uno.hash(turn)+1) > $uno.hash(players),1,$v1),$iif($calc($uno.hash(turn)-1) > 0,$v1,$uno.hash(players))),32)
  }
  elseif ($istok(pl play,$1,32)) {
    if ($uno.hash(on) !isnum 2-4) uno.msg %chan You can't play a card because the game hasn't started.
    elseif (!$istok($uno.hash(names),%nick,32)) uno.msg %chan You arn't in this game.
    elseif ($findtok($uno.hash(names),%nick,1,32) != $uno.hash(turn)) uno.msg %chan It isn't your turn.
    elseif (!$2) uno.msg %chan You must supply a card to play.
    elseif ($2 != S) && ($uno.hash(draw)) && ($v1 != $2) uno.msg %chan You can only play the card you drew.
    elseif ($2 != S) && (!$istok($uno.hash(%nick),$2,32)) uno.msg %chan You don't have that card in your hand.
    else {
      var %n $iif($uno.hash(order),$iif($calc($uno.hash(turn)+1) > $uno.hash(players),1,$v1),$iif($calc($uno.hash(turn)-1) > 0,$v1,$uno.hash(players)))
      if ($2 == S) {
        if ($3 !isnum 0-9) && (!$istok(R S D2,$3,32)) { uno.msg %chan That is an invalid card to stack. | return }
        if (!$4) || (!$istok(B G R Y,$4,32)) { uno.msg %chan You must supply the ending color of the stack. | return }
        if ($uno.hash(draw)) && ($right($v1,$len($3)) != $3) { uno.msg %chan You can only start a stack with the card you drew. | return }
        if (!$istok($uno.hash(%nick),$4 $+ $3,32)) { uno.msg %chan You don't have $uno.cards($4 $+ $3) in your hand. | return }
        if ($left($uno.hash(top),1) == $4) && ($regex($uno.hash(%nick),$+(/\b,$4,$3,\b/ig)) == 1) && ($right($uno.hash(top),-1) != $3) { uno.msg %chan The card you supplied for the end of the stack must be used at the front. Try a different combination for your stack. | return }
        var %a 1,%cards
        while $gettok($uno.hash(%nick),%a,32) {
          var %c $v1,%r
          if (W* !iswm %c) && ($len(%c) == $len($+($4,$3))) && ($+(*,$3) iswm %c) %cards = %cards %c
          inc %a
        }
        if ($token(%cards,0,32) == 1) { uno.msg %chan You can't play a stack with only one card. | return }
        var %a 1
        while ($gettok(%cards,%a,32)) {
          hadd uno %nick $remtok($uno.hash(%nick),$v1,1,32)
          inc %a
        }
        if ($3 == R) {
          %c = $remtok(%cards,$4 $+ $3,1,32) $4 $+ $3
          uno.msg %chan  $+ %nick played $uno.cards($iif($len($uno.hash(top)) == 1 || * $+ $3 !iswm $uno.hash(top),$left($uno.hash(top),1) $+ $3 $remtok(%c,$left($uno.hash(top),1) $+ $3,1,32),%c)) $iif($uno.hash(players) > 2,reversing $gettok(%cards,0,32) times.,and since it's 1 on 1 skipped $gettok($uno.hash(names),%n,32) $+ 's turn.) 
          if ($uno.hash(players) < 3) %n = $uno.hash(turn)
          else { hadd uno order $calc(($uno.hash(order) + $gettok(%cards,0,32)) % 2) | %n = $iif($uno.hash(order),$iif($calc($uno.hash(turn)+1) > $uno.hash(players),1,$v1),$iif($calc($uno.hash(turn)-1) > 0,$v1,$uno.hash(players))) }
        }
        elseif ($3 == S) {
          %c = $remtok(%cards,$4 $+ $3,1,32) $4 $+ $3
          uno.msg %chan  $+ %nick played $uno.cards($iif($len($uno.hash(top)) == 1 || * $+ $3 !iswm $uno.hash(top),$left($uno.hash(top),1) $+ $3 $remtok(%c,$left($uno.hash(top),1) $+ $3,1,32),%c)) skipping $iif($uno.hash(players) > 2,$gettok(%cards,0,32) turns.,$gettok($uno.hash(names),%n,32) $+ 's turn.)
          if ($uno.hash(players) < 3) %n = $uno.hash(turn)
          else {
            if ($uno.hash(order)) {
              %n = $calc($uno.hash(turn) + $gettok(%cards,0,32) + 1)
              while (%n > $uno.hash(players)) %n = %n - $uno.hash(players)
            }
            else {
              %n = $calc($uno.hash(turn) - $gettok(%cards,0,32) - 1)
              while (%n < 1) %n = %n + $uno.hash(players)
            }
          }
        }
        elseif ($3 == D2) {
          if ($gettok($uno.hash(deck),0,32) < $calc($gettok(%cards,0,32)*2)) { hadd uno deck $uno.hash(deck) $gettok($uno.hash(played),2-,32) | hadd uno played $gettok($uno.hash(played),1,32) | uno.msg %chan The deck has been reshuffled for $gettok($uno.hash(names),%n,32) to pick up 4 cards. }
          var %a 1,%c
          while %a <= $calc($gettok(%cards,0,32)*2) {
            %c = $gettok($uno.hash(deck),$r(1,$gettok($uno.hash(deck),0,32)),32)
            hadd uno deck $remtok($uno.hash(deck),%c,1,32)
            hadd uno $gettok($uno.hash(names),%n,32) $uno.hash($gettok($uno.hash(names),%n,32)) %c
            hadd uno new. $+ $gettok($uno.hash(names),%n,32) $uno.hash(new. $+ $gettok($uno.hash(names),%n,32)) %c
            inc %a
          }
          %c = $remtok(%cards,$4 $+ $3,1,32) $4 $+ $3
          uno.msg %chan  $+ %nick played $uno.cards($iif($len($uno.hash(top)) == 1 || * $+ $3 !iswm $uno.hash(top),$left($uno.hash(top),1) $+ $3 $remtok(%c,$left($uno.hash(top),1) $+ $3,1,32),%c)) making $gettok($uno.hash(names),%n,32) pick up $calc($gettok(%cards,0,32)*2) $iif($uno.set(drawskips),cards and skipping their turn.,cards.)
          if ($uno.set(drawskips)) var %n = $iif($uno.hash(order),$iif($calc(1+%n) > $uno.hash(players),1,$v1),$iif($calc(%n -1) > 0,$v1,$uno.hash(players)))
        }
        else { %c = $remtok(%cards,$4 $+ $3,1,32) $4 $+ $3 | uno.msg %chan  $+ %nick played $uno.cards($iif($len($uno.hash(top)) == 1 || * $+ $3 !iswm $uno.hash(top),$left($uno.hash(top),1) $+ $3 $remtok(%c,$left($uno.hash(top),1) $+ $3,1,32),%c)) $+ . }
        hadd uno top $4 $+ $3
        hadd uno played %cards $uno.hash(played)
        hinc uno played. $+ %nick $gettok(%cards,0,32)
        hinc uno cardsplayed $gettok(%cards,0,32)
      }
      elseif ($istok(W WD4,$2,32)) {
        if (!$3) || (!$istok(B G R Y,$3,32)) { uno.msg %chan You must supply a $iif($3 && !$istok(B G R Y,$3,32),valid) color to change to. | return }
        if ($right($2,2) == D4) {
          uno.msg %chan  $+ %nick played $uno.cards($2) making $gettok($uno.hash(names),%n,32) pick up 4, $iif($uno.set(drawskips),skipping their turn $+ $chr(44)) and changed the suit to $uno.cards($3)
          if ($gettok($uno.hash(deck),0,32) < 4) { hadd uno deck $uno.hash(deck) $gettok($uno.hash(played),2-,32) | hadd uno played $gettok($uno.hash(played),1,32) | uno.msg %chan The deck has been reshuffled for $gettok($uno.hash(names),%n,32) to pick up 4 cards. }
          var %a 1,%c
          while %a < 5 {
            %c = $gettok($uno.hash(deck),$r(1,$gettok($uno.hash(deck),0,32)),32)
            hadd uno deck $remtok($uno.hash(deck),%c,1,32)
            hadd uno $gettok($uno.hash(names),%n,32) $uno.hash($gettok($uno.hash(names),%n,32)) %c
            hadd uno new. $+ $gettok($uno.hash(names),%n,32) $uno.hash(new. $+ $gettok($uno.hash(names),%n,32)) %c
            inc %a
          }
        }
        else uno.msg %chan  $+ %nick played $uno.cards($2) and changed the suit to $uno.cards($3)
        if ($right($2,2) == D4) && ($uno.set(drawskips)) var %n = $iif($uno.hash(order),$iif($calc(1+%n) > $uno.hash(players),1,$v1),$iif($calc(%n -1) > 0,$v1,$uno.hash(players)))
      }
      elseif ($len($2) == 2) && ($right($2,1) !isnum 0-9) {
        if ($left($2,1) != $left($uno.hash(top),1)) && ($right($2,1) != $iif($len($uno.hash(top)) == 1,..,$right($uno.hash(top),1))) { uno.msg %chan That is an invalid card. | return }
        if ($right($2,1) == R) {
          if ($uno.hash(players) == 2) { uno.msg %chan  $+ %nick played $uno.cards($2) and since it's 1 on 1, skipped $gettok($uno.hash(names),%n,32) $+ 's turn. | %n = $uno.hash(turn) }
          else { uno.msg %chan  $+ %nick played $uno.cards($2) and reversed the order. | hadd uno order $iif($uno.hash(order),0,1) | %n = $iif($uno.hash(order),$iif($calc($uno.hash(turn)+1) > $uno.hash(players),1,$v1),$iif($calc($uno.hash(turn)-1) > 0,$v1,$uno.hash(players))) }
        }
        elseif ($right($2,1) == S) { uno.msg %chan  $+ %nick played $uno.cards($2) and skipped $gettok($uno.hash(names),%n,32) $+ 's turn. | %n = $iif($uno.hash(order),$iif($calc($uno.hash(turn)+2) > $uno.hash(players),$calc($v1 - $v2),$v1),$iif($calc($uno.hash(turn)-2) < 1,$calc($uno.hash(players)+ $v1),$v1)) }
      }
      elseif ($len($2) == 2) && ($right($2,1) isnum 0-9) {
        if (($len($uno.hash(top)) != 2) && ($left($2,1) != $left($uno.hash(top),1))) || (($len($uno.hash(top)) == 2) && ($left($2,1) != $left($uno.hash(top),1)) && ($right($2,1) != $right($uno.hash(top),1))) { uno.msg %chan That is an invalid card. | return }
        uno.msg %chan  $+ %nick played $uno.cards($2) $+ .
      }
      elseif ($right($2,2) == D2) {
        if ($left($2,1) != $left($uno.hash(top),1)) && ($right($uno.hash(top),2) != D2) { uno.msg %chan That is the wrong color. | return }
        uno.msg %chan  $+ %nick played $uno.cards($2) making $gettok($uno.hash(names),%n,32) pick up 2 $iif($uno.set(drawskips),cards and skipping their turn.,cards.)
        if ($gettok($uno.hash(deck),0,32) < 2) { hadd uno deck $uno.hash(deck) $gettok($uno.hash(played),2-,32) | hadd uno played $gettok($uno.hash(played),1,32) | uno.msg %chan The deck has been reshuffled for $gettok($uno.hash(names),%n,32) to pick up 2 cards. }
        var %a 1,%c
        while %a < 3 {
          %c = $gettok($uno.hash(deck),$r(1,$gettok($uno.hash(deck),0,32)),32)
          hadd uno deck $remtok($uno.hash(deck),%c,1,32)
          hadd uno $gettok($uno.hash(names),%n,32) $uno.hash($gettok($uno.hash(names),%n,32)) %c
          hadd uno new. $+ $gettok($uno.hash(names),%n,32) $uno.hash(new. $+ $gettok($uno.hash(names),%n,32)) %c
          inc %a
        }
        if ($uno.set(drawskips)) var %n = $iif($uno.hash(order),$iif($calc(1+%n) > $uno.hash(players),1,$v1),$iif($calc(%n -1) > 0,$v1,$uno.hash(players)))
      }
      else { uno.msg %chan That is an invalid card. | return }
      if ($uno.hash(draw)) hdel uno draw
      if ($2 != S) {
        hadd uno top $iif(W* iswm $2,$3,$2)
        hadd uno %nick $remtok($uno.hash(%nick),$2,1,32)
        hadd uno played $2 $uno.hash(played)
        hinc uno played. $+ %nick 1
        hinc uno cardsplayed 1
      }
      hadd uno turn %n
      if ($uno.hash(draw)) hdel uno draw
      if (!$uno.hash(%nick)) {
        uno.msg %chan 4 $+ %nick has won the game in $duration($calc($ctime -$uno.hash(started))) $+ !
        var %a 1,%p 0
        while $gettok($uno.hash(names),%a,32) {
          var %b 1,%n $v1,%cp 0
          if (%n == %nick) { inc %a | continue }
          if (%n == $me) var %addr = UNOBot
          else var %addr = $address(%n,2)
          if ($readini($scriptdirsettings.ini,oldpoints,$md5(%addr))) {
            writeini -n $+(",$scriptdirsettings.ini") points %addr $v1
            remini $+(",$scriptdirsettings.ini") oldpoints $md5(%addr)
          }
          var %wl = $readini($scriptdirsettings.ini,winslosses,%addr)
          writeini -n $+(",$scriptdirsettings.ini") points %addr $calc($readini($+(",$scriptdirsettings.ini"),points,%addr)+0)
          writeini -n $+(",$scriptdirsettings.ini") winslosses %addr $calc($gettok(%wl,1,32)+0) $calc($gettok(%wl,2,32)+1)
          writeini -n $+(",$scriptdirsettings.ini") nicks %addr %n
          while $gettok($uno.hash(%n),%b,32) {
            var %c $v1
            inc %cp $iif(W* iswm %c,50,$iif($len(%c) == 2 && $right(%c,1) isnum,$v1,20))
            inc %b
          }
          uno.msg %chan  $+ %n has cards $uno.cards($uno.hash(%n)).sort left, totaling %cp points.
          inc %p %cp
          inc %a
        }
        if (%nick == $me) var %addr = UNOBot
        else var %addr = $gettok(%wildsite,2-,64)
        if ($uno.set(awards)) {
          var %b 0
          if (%p > $uno.set(pointsearned).bonus) {
            uno.msg %chan  $+ %nick got the most points in any game (more than $v2 $+ !), adding a $uno.set(pointsearned).awards point reward to their points!
            writeini -n $+(",$scriptdirsettings.ini") bonus pointsearned %p 
            writeini -n $+(",$scriptdirsettings.ini") earned pointsearned %addr
            inc %b $uno.set(pointsearned).awards
          }
          if ($calc($ctime -$uno.hash(started)) < $uno.set(fastest).bonus) {
            uno.msg %chan  $+ %nick completed the game the fastest (faster than $duration($v2) $+ !), adding a $uno.set(fastest).awards point reward to their points!
            writeini -n $+(",$scriptdirsettings.ini") bonus fastest $calc($ctime -$uno.hash(started)) 
            writeini -n $+(",$scriptdirsettings.ini") earned fastest %addr
            inc %b $uno.set(fastest).awards
          }
          if ($uno.hash(played. $+ %nick) > $uno.set(cardsplayed).bonus) {
            uno.msg %chan  $+ %nick played the most cards in any game (more than $v2 $+ !), adding a $uno.set(cardsplayed).awards point reward to their points!
            writeini -n $+(",$scriptdirsettings.ini") bonus cardsplayed $uno.hash(played. $+ %nick)
            writeini -n $+(",$scriptdirsettings.ini") earned cardsplayed %addr
            inc %b $uno.set(cardsplayed).awards
          }
          if (%p == 21) { uno.msg %chan  $+ %nick ended the game with exactly 21 points to get blackjack, adding a $uno.set(blackjack).awards point reward to their points! | inc %b $uno.set(blackjack).awards }
          elseif (%p == 100) { uno.msg %chan  $+ %nick ended the game with exactly 100, adding a $uno.set(hundred).awards point reward to their points! | inc %b $uno.set(blackjack).awards }
          if ($uno.set(streak).earned == %addr) && ($calc($uno.set(streak).bonus +1) > 1) {
            uno.msg %chan  $+ %nick is on a $v1 win winning streak, adding a $uno.set(streaks).awards * $calc($uno.set(streak).bonus +1) ( $+ $calc($uno.set(streaks).awards * $calc($uno.set(streak).bonus +1)) $+ ) point reward to their points!
            writeini -n $+(",$scriptdirsettings.ini") bonus streak $calc($uno.set(streak).bonus +1) 
            inc %b $calc($uno.set(streaks).awards * $uno.set(streak).bonus)
          }
          elseif ($uno.set(streak).earned != $gettok(%wildsite,2-,64)) {
            if ($uno.set(streak).bonus >= $uno.set(streakbreaker).bonus) { uno.msg %chan  $+ %nick broke $uno.set($uno.set(streak).earned).nicks $+ 's streak of $uno.set(streak).bonus wins, adding a $uno.set(streakbreaker).awards * $uno.set(streak).bonus ( $+ $calc($uno.set(streakbreaker).awards * $uno.set(streak).bonus) $+ ) point reward to their points! | inc %b $calc($uno.set(streakbreaker).awards * $uno.set(streak).bonus) }
            writeini -n $+(",$scriptdirsettings.ini") earned streak %addr
            writeini -n $+(",$scriptdirsettings.ini") bonus streak 1
          }
          inc %p %b
        }
        if ($readini($scriptdirsettings.ini,oldpoints,$md5(%wildsite))) {
          writeini -n $+(",$scriptdirsettings.ini") points %addr $v1
          remini $+(",$scriptdirsettings.ini") oldpoints $md5(%wildsite)
        }
        writeini -n $+(",$scriptdirsettings.ini") points %addr $calc($uno.points(%addr)+%p)
        writeini -n $+(",$scriptdirsettings.ini") nicks %addr %nick
        var %wl = $readini($scriptdirsettings.ini,winslosses,%addr)
        writeini -n $+(",$scriptdirsettings.ini") winslosses %addr $calc($gettok(%wl,1,32)+1) $calc($gettok(%wl,2,32)+0)
        uno.msg %chan 14 $+ %nick gained %p points, now having $uno.points(%addr) points total ( $+ $replace($uno.set(%addr).winslosses,$chr(32),$+($chr(32),wins,$chr(44),$chr(32))) losses) bringing them in $uno.points(%wildsite).rank place. Type $uno.set(trigger) $+ join to join a new game!
        hdel -w uno *
        hadd uno on 1
        return
      }
      uno.msg %chan  $+ $gettok($uno.hash(names),$uno.hash(turn),32) $+ 's turn with $gettok($uno.hash($gettok($uno.hash(names),$uno.hash(turn),32)),0,32) cards. Playing on: $uno.cards($uno.hash(top))
      uno.msg $gettok($uno.hash(names),$uno.hash(turn),32) Cards: $uno.cards($uno.hash($gettok($uno.hash(names),$uno.hash(turn),32))).sort $iif($uno.hash(new. $+ $gettok($uno.hash(names),$uno.hash(turn),32)),New: $uno.cards($v1).sort)
      if ($uno.hash(new. $+ $gettok($uno.hash(names),$uno.hash(turn),32))) hdel uno new. $+ $gettok($uno.hash(names),$uno.hash(turn),32)
    }
  }
  elseif ($findtok(dr draw pa pass,$1,1,32)) {
    var %cmd $gettok(draw draw pass pass,$v1,32)
    if ($uno.hash(on) !isnum 2-) uno.msg %chan You can't %cmd because the game hasn't started.
    elseif (!$istok($uno.hash(names),%nick,32)) uno.msg %chan You arn't in this game.
    elseif ($findtok($uno.hash(names),%nick,1,32) != $uno.hash(turn)) uno.msg %chan It isn't your turn.
    elseif ($uno.hash(draw)) && (%cmd == draw) uno.msg %chan You can't draw again. Type $uno.set(trigger) $+ play Card if you can play a card, or $uno.set(trigger) $+ pass to pass.
    elseif (!$uno.hash(draw)) && (%cmd == pass) uno.msg %chan You can't pass untill you draw. Type $uno.set(trigger) $+ draw to draw a card.
    else {
      if (%cmd == draw) {
        var %n $iif($uno.hash(order),$iif($calc($uno.hash(turn)-1) > 0,$v1,$uno.hash(players)),$iif($calc($uno.hash(turn)+1) < $uno.hash(players),$v1,1))
        if ($gettok($uno.hash(deck),0,32) < 1) { hadd uno deck $uno.hash(deck) $gettok($uno.hash(played),2-,32) | hadd uno played $gettok($uno.hash(played),1,32) | uno.msg %chan The deck has been reshuffled for $gettok($uno.hash(names),%n,32) to pick up their card. }
        var %c = $gettok($uno.hash(deck),$r(1,$gettok($uno.hash(deck),0,32)),32)
        hadd uno deck $remtok($uno.hash(deck),%c,1,32)
        hadd uno %nick $uno.hash(%nick) %c
        hadd uno draw %c
        if (!$uno.set(unocmd)) uno.msg %chan  $+ %nick drew a card.
        uno.msg %nick Cards: $uno.cards($uno.hash(%nick)).sort New: $uno.cards(%c)
      }
      else {
        hdel uno draw
        uno.msg %chan  $+ %nick passed their turn.
        hadd uno turn $iif($uno.hash(order),$iif($calc($uno.hash(turn)+1) > $uno.hash(players),1,$v1),$iif($calc($uno.hash(turn)-1) > 0,$v1,$uno.hash(players)))
        uno.msg %chan  $+ $gettok($uno.hash(names),$uno.hash(turn),32) $+ 's turn with $gettok($uno.hash($gettok($uno.hash(names),$uno.hash(turn),32)),0,32) cards. Playing on: $uno.cards($uno.hash(top))
        uno.msg $gettok($uno.hash(names),$uno.hash(turn),32) Cards: $uno.cards($uno.hash($gettok($uno.hash(names),$uno.hash(turn),32))).sort $iif($uno.hash(new. $+ $gettok($uno.hash(names),$uno.hash(turn),32)),New: $uno.cards($v1).sort)
        if ($uno.hash(new. $+ $gettok($uno.hash(names),$uno.hash(turn),32))) hdel uno new. $+ $gettok($uno.hash(names),$uno.hash(turn),32)
      }
    }
  }
  elseif ($1 == shuffle) {
    if ($uno.hash(on) !isnum 2-) uno.msg %chan You can't shuffle because the game hasn't started.
    elseif (!$istok($uno.hash(names),%nick,32)) uno.msg %chan You arn't in this game.
    elseif ($uno.access(shuffle,%nick)) uno.msg %chan You must be $v1 to use that command.
    elseif (!$token($uno.hash(played),0,32)) uno.msg %chan There are no cards to shuffle at this time.
    else {
      hadd uno deck $uno.hash(deck) $gettok($uno.hash(played),2-,32)
      hadd uno played $gettok($uno.hash(played),1,32)
      uno.msg %chan The deck has been reshuffled by $nick $+ .
    }
  }
  elseif ($1 == replace) {
    if ($uno.access($1,%nick,%chan)) uno.msg %chan You must be $v1 to use that command.
    elseif ($uno.hash(on) !isnum 2-) uno.msg %chan There is no game to be placed on the replace list for.
    elseif ($istok($uno.hash(names),%nick,32)) uno.msg %chan You are already in the game.
    elseif ($istok($uno.hash(replace),%nick,32)) uno.msg %chan You are already on the replace list.
    else {
      hadd uno replace $uno.hash(replace) %nick
      uno.msg %chan  $+ %nick has been added to the replace list in case someone leaves the game.
    }
  }
  elseif ($1 == botreplace) {
    if ($uno.access($1,%nick,%chan)) uno.msg %chan You must be $v1 to use that command.
    elseif ($uno.hash(on) !isnum 2-) uno.msg %chan There is no game to be placed on the replace list for.
    elseif ($istok($uno.hash(names),$me,32)) uno.msg %chan I'm already in the game.
    elseif ($istok($uno.hash(replace),$me,32)) uno.msg %chan I'm already on the replace list.
    else {
      hadd uno replace $uno.hash(replace) $nick
      uno.msg %chan I have been added to the replace list in case someone leaves the game.
    }
  }
  elseif ($1 == off) {
    if ($uno.access($1,%nick,%chan)) uno.msg %chan You must be $v1 to use that command.
    elseif (!$uno.hash(on)) uno.msg %chan 8UNO14 is not on.
    else { uno.msg %chan  $+ %nick has turned 8UNO14 off. | hfree uno | window -c @unospam }
  }
  elseif ($1 == help) {
    tokenize 32 $iif($2,$2,help)
    if ($uno.access($1,%nick,%chan)) uno.msg %chan You must be $v1 to use that command.
    elseif (!$uno.help($1)) uno.msg %nick Invalid topic.
    else uno.msg %nick $replacecs($uno.help($1),UNO,$+(7,$chr(44),1U8N0O),^,,*,$uno.set(trigger))
  }
  elseif ($1 == trigger) {
    if ($uno.access($1,%nick)) uno.msg %chan You must be $v1 to use that command.
    elseif (!$2) uno.msg %chan You must supply a trigger.
    elseif ($asc($left($2,1)) !isnum 33-126) uno.msg %chan That is an invalid trigger.
    else { writeini -n $+(",$scriptdirsettings.ini") settings trigger $left($2,1) | uno.msg %chan  $+ %nick changed trigger to $uno.set(trigger) $+ . }
  }
  elseif ($1 == addadmin) {
    if ($uno.access($1,%nick)) uno.msg %chan You must be $v1 to use that command.
    elseif (!$2) || ($2 !ison %chan) uno.msg %chan You must supply a nick in this channel.
    elseif ($uno.set($address($2,2)).admin) uno.msg %chan  $+ $2 is already an admin.
    else { writeini -n $+(",$scriptdirsettings.ini") admins $address($2,2) 1 | uno.msg %chan $+(,$2 ,$chr(40),,$address($2,2),,$chr(41)) was added as an admin. }
  }
  elseif ($1 == deladmin) {
    if ($uno.access($1,%nick)) uno.msg %chan You must be $v1 to use that command.
    elseif (!$2) || ($2 !ison %chan) || (!$uno.set($2).admin) uno.msg %chan You must supply a nick in this channel, or the address of an admin.
    elseif (%nick == $2) || (%wildsite == $2) uno.msg %chan You cant delete yourself.
    elseif (!$uno.set($2).admin) && (!$uno.set($address($2,2)).admin) uno.msg %chan That nick/address does not belong to an admin.
    else { remini $+(",$scriptdirsettings.ini") admins $iif($uno.set($2).admin,$2,$address($2,2)) | uno.msg %chan $+($iif($uno.set($2).admin,$+(,$2,),$+(,$2 ,$chr(40),,$address($2,2),,$chr(41))) has been deleted from the admins. }
  }
  elseif ($1 == suspend) {
    if ($uno.access($1,%nick)) uno.msg %chan You must be $v1 to use that command.
    elseif (!$2) || ($2 !ison %chan) || (!$uno.set($2).admin) uno.msg %chan You must supply a nick in this channel, or the address of an admin.
    elseif (!$uno.set($2).admin) && (!$uno.set($address($2,2)).admin) uno.msg %chan That nick/address does not belong to an admin.
    elseif (%nick == $2) || (%wildsite == $2) uno.msg %chan You cant suspend yourself.
    elseif ($uno.set($2).admin == 2) || ($uno.set($address($2,2)).admin == 2) uno.msg %chan That admin is already suspended.
    else { writeini -n $+(",$scriptdirsettings.ini") admins $iif($uno.set($2).admin,$2,$address($2,2)) 2 | uno.msg %chan $+($iif($uno.set($2).admin,$+(,$2,),$+(,$2 ,$chr(40),,$address($2,2),,$chr(41))) was suspended. }
  }
  elseif ($1 == unsuspend) {
    if ($uno.access($1,%nick)) uno.msg %chan You must be $v1 to use that command.
    elseif (!$2) || ($2 !ison %chan) || (!$uno.set($2).admin) uno.msg %chan You must supply a nick in this channel, or the address of an admin.
    elseif (!$uno.set($2).admin) && (!$uno.set($address($2,2)).admin) uno.msg %chan That nick/address does not belong to an admin.
    elseif (%nick == $2) || (%wildsite == $2) uno.msg %chan You cant unsuspend yourself.
    elseif ($uno.set($2).admin != 2) || ($uno.set($address($2,2)).admin != 2) uno.msg %chan That admin isn't suspended.
    else { writeini -n $+(",$scriptdirsettings.ini") admins $iif($uno.set($2).admin,$2,$address($2,2)) 1 | uno.msg %chan $+($iif($uno.set($2).admin,$+(,$2,),$+(,$2 ,$chr(40),,$address($2,2),,$chr(41))) was unsuspended. }
  }
  elseif ($1 == score) {
    var %w %wildsite
    if ($2) {
      if ($2 !ison %chan) { 
        var %a 1
        while ($ini($scriptdirsettings.ini,nicks,%a)) {
          if ($readini($scriptdirsettings.ini,nicks,$v1) == $2) { %w = $ini($scriptdirsettings.ini,nicks,%a) | break }
          inc %a
        }
        if (!%w) { uno.msg %chan I can't see $2 $+ . | halt }
      }
      elseif ($2 == $me) %w = UNOBot
      else %w = $gettok($address($2,2),2-,64)
    }
    uno.msg %chan  $+ $iif($2,$2,%nick) has $iif($uno.points(%w) != $!, $+ $v1 points ( $+ $replace($uno.set(%w).winslosses,$chr(32),$+($chr(32),wins,$chr(44),$chr(32))) losses) and is ranked $uno.points(%w).rank $+ !,no points.)
  }
  elseif ($1 == records) uno.msg %chan Fastest game $iif($uno.set(fastest).earned,$+(by ,$uno.set($v1).nicks,:),not obtained yet:) $duration($uno.set(fastest).bonus) ( $+ $uno.set(fastest).awards reward) Most cards played $iif($uno.set(cardsplayed).earned,$+(by ,$uno.set($v1).nicks,:),not obtained yet:) $uno.set(cardsplayed).bonus ( $+ $uno.set(cardsplayed).awards reward) Most points earned $iif($uno.set(pointsearned).earned,$+(by ,$uno.set($v1).nicks,:),not obtained yet:) $uno.set(pointsearned).bonus ( $+ $uno.set(pointsearned).awards reward)
  elseif ($1 == elapsed) {
    if ($uno.hash(on) !isnum 2-) uno.msg %chan The game hasn't started so there has been no elapsed time.
    else uno.msg %chan The game has been running for $duration($calc($ctime -$uno.hash(started))) $+ .
  }
  elseif ($1 == played) {
    if ($uno.hash(on) !isnum 2-) uno.msg %chan The game hasn't started so no cards have been played.
    else {
      var %a 1,%m Total Cards Played: $uno.hash(cardsplayed) $+ 
      while ($gettok($uno.hash(names),%a,32)) {
        %m = %m $+(,$v1,:) $uno.hash(played. $+ $v1)
        if ($len(%m) > 500) { uno.msg %chan %m | %m = }
        inc %a
      }
      if (%m) uno.msg %chan %m
    }
  }
  elseif ($1 == top) {
    if (!$2) tokenize 32 $1 10
    if (!$ini($+(",$scriptdirsettings.ini"),points,0)) uno.msg %chan Noone has any points yet.
    elseif ($2 !isnum 1-10) uno.msg %chan You can only check the top 1 to 10 players.
    else {
      window -sln @Ranks
      var %a 1
      while $ini($+(",$scriptdirsettings.ini"),points,%a) {
        aline @Ranks $base($readini($+(",$scriptdirsettings.ini"),points,$v1),10,10,200) $v1
        inc %a
      }
      var %b 1,%m Top $2 Players -
      while (%b <= $iif($line(@Ranks,0) < $2,$v1,$v2)) {
        var %w = $gettok($line(@Ranks,$calc(1+ $line(@Ranks,0) -%b)),2,32),%m = %m  $+ $ord(%b) $+ : $iif($uno.set(%w).nicks,$v1,*!*@ $+ $w) - $calc($gettok($line(@Ranks,$calc(1+ $line(@Ranks,0) -%b)),1,32)) ( $+ $replace($uno.set(%w).winslosses,$chr(32),$+($chr(32),wins,$chr(44),$chr(32))) losses)
        if ($len(%m) > 500) { uno.msg %chan %m | %m = }
        inc %b
      }
      if (%m) uno.msg %chan %m
      window -c @Ranks
    }
  }
}
on *:PART:$($uno.set(channel)):uno.left $chan $nick
on *:QUIT:if ($nick ison $uno.set(channel)) uno.left $v2 $nick
on *:KICK:$($uno.set(channel)):uno.left $chan $nick
on *:BAN:$($uno.set(channel)):uno.left $chan $nick
on *:NICK:{
  if ($nick !ison $uno.set(channel)) || (!$uno.hash(on)) || (!$istok($uno.hash(names),$2,32)) return
  hadd uno $newnick $uno.hash($nick)
  hadd uno played. $+ $newnick $uno.hash(played. $+ $newnick)
  hdel uno $nick
  hdel uno played. $+ $newnick
  hadd uno names $reptok($uno.hash(names),$nick,$newnick,1,32)
}
alias uno.left {
  if ($istok($uno.hash(replace),$2,32)) { hadd uno replace $remtok($uno.hash(replace),$2,32) | return }
  if (!$uno.hash(on)) || (!$istok($uno.hash(names),$2,32)) return
  if ($uno.hash(on) == 1) { hadd uno names $remtok($uno.hash(names),$2,32) | hdec uno players 1 | uno.msg $1  $+ $2 has left the game. $iif($uno.hash(players) > 1,Type  $uno.set(trigger) $+ start to begin the game.) }
  elseif ($uno.hash(on) isnum 2-3) { 
    if ($gettok($uno.hash(replace),1,32)) {
      uno.msg $1  $+ $2 has left the game and was replaced with $v1 $+ .
      hadd uno $v1 $uno.hash($2)
      hadd uno played. $+ $v1 $uno.hash($2)
      hdel uno $2
      hdel uno played. $+ $2
      hadd uno names $reptok($uno.hash(names),$2,$v1,1,32)
      hadd uno replace $remtok($uno.hash(replace),$v1,32)
      if ($gettok($uno.hash(names),$uno.hash(turn),32) == $v1) {
        var %n $v1
        uno.msg $1  $+ %n $+ 's turn with $gettok($uno.hash(%n),0,32) cards. Playing on: $uno.cards($uno.hash(top))
        uno.msg %n Cards: $uno.cards($uno.hash(%n)).sort
        uno.msg %n Cards: $uno.cards($uno.hash(%n)).sort $iif($uno.hash(new. $+ %n),New: $uno.cards(%n).sort)
        if ($uno.hash(new. $+ %n)) hdel uno new. $+ %n
      }
    }
    else {
      if ($uno.hash(players) == 2) { uno.msg $1  $+ $2 left the game. There are no replacements and only one player left so the game has been turned off. | hfree uno | return }
      uno.msg $1  $+ $2 hash left the game. There are no people on the replace list so their cards were put in the deck.
      hadd uno deck $uno.hash(deck) $uno.hash($2)
      hdel uno $2
      hdel uno played. $+ $2
      hadd uno names $remtok($uno.hash(names),$2,32)
      if ($gettok($uno.hash(names),$uno.hash(turn),32) == $2) {
        if (!$uno.hash(order)) hadd uno turn $iif($calc($uno.hash(turn)-1) < 1,$calc($uno.hash(players)-1),$v1)
        uno.msg $1  $+ $gettok($uno.hash(names),$uno.hash(turn),32) $+ 's turn with $gettok($uno.hash($gettok($uno.hash(names),$uno.hash(turn),32)),0,32) cards. Playing on: $uno.cards($uno.hash(top))
        uno.msg $gettok($uno.hash(names),$uno.hash(turn),32) Cards: $uno.cards($uno.hash($gettok($uno.hash(names),$uno.hash(turn),32))).sort $iif($uno.hash(new. $+ $gettok($uno.hash(names),$uno.hash(turn),32)),New: $uno.cards($v1).sort)
        if ($uno.hash(new. $+ $gettok($uno.hash(names),$uno.hash(turn),32))) hdel uno new. $+ $gettok($uno.hash(names),$uno.hash(turn),32)
      }
    }
  }
}
alias uno.set return $readini($+(",$scriptdirsettings.ini"),$iif($prop,$v1,settings),$1)
alias uno.msg {
  if (!$window(@unomsgs)) window -lhn @unomsgs
  if ($1) {
    var %msg $iif(!$uno.set(noprefix),$+(4,$chr(44),1[7U8N0O4])) 14,1 $+ $2- 
    if ($uno.set(nocolor)) || (*c* iswmcs $chan($1).mode) %msg = $strip(%msg,c)
    aline @unomsgs $iif($1 ischan,msg,$iif($1 == $me,noop,notice)) $1 %msg
  }
  while (($hget(uno,spam) == $!) || ($hget(uno,spam) < $uno.set(spamlines))) && ($line(@unomsgs,0)) {
    var %l $line(@unomsgs,1)
    if (msg * $me $+ 's turn with * cards. Playing on: * iswm $strip(%l)) || $&
      (msg * $me drew a card. iswm $strip(%l)) .timerunobotthink -m 1 1 uno.bot.think $gettok(%l,2,32)
    if (bot * $uno.set(trigger) $+ * iswm $strip(%l)) { msg $gettok(%l,2-,32) | .timerunobotgo -m 1 1 uno.cmd $gettok(%l,2,32) $me $right($gettok(%l,3-,32),-1) }
    else %l
    hinc -mu [ $+ [ $uno.set(spamtime) ] ] uno spam 1
    dline @unomsgs 1
  }
  if ($line(@unomsgs,0)) .timerunospam 1 1 uno.msg
}
alias uno.bot.think {
  var %a 1,%t $uno.hash(top),%c,%r 0,%n $gettok($uno.hash(names),$iif($uno.hash(order),$iif($calc($uno.hash(turn)+1) > $uno.hash(players),1,$v1),$iif($calc($uno.hash(turn)-1) > 0,$v1,$uno.hash(players))),32)
  while ($gettok($uno.hash($me),%a,32)) {
    var %o $v1,%lf,%l = $remtok($uno.hash($me),%o,1,32)
    if ($left(%o,1) == $left(%t,1)) || (($len(%t) > 1) && ($right(%o,-1) == $right(%t,-1))) {
      var %b 1,%nc %o
      while ($gettok($uno.hash($me),%b,32)) {
        var %cc $v1
        if (%b != %a) && ($right(%cc,-1) == $right(%o,-1)) var %nc = %nc $gettok($uno.hash($me),%b,32),%l = $remtok(%l,$gettok($uno.hash($me),%b,32),1,32)
        inc %b
      }
      if ($token(%nc,0,32) > 1) {
        var %b 1,%ct = $sorttok($+($count(%l,B),-B) $+($count(%l,G),-G) $+($regex(%l,/\bR/gi),-R) $+($count(%l,Y),-Y),32,nr),%cs
        while ($gettok(%ct,%b,32)) {
          var %cs = $v1,%am = $regex(%nc,/\b( $+ $gettok(%cs,2,45) $+ \S{1,2})\b/gi)
          if (%am) && (($left(%t,1) != $gettok(%cs,2,45)) || (%am > 1)) break 
          inc %b
        }
        if (0*0*0*0* iswm %ct) %cs = 0- $+ $left($gettok(%nc,-1,32),1)
      }
      else %cs = $+($regex(%l,$+(/\b,$left(%nc,1),/gi)),-,$left(%nc,1))
      if ($calc($iif($regex(%nc,/S|\SR|D2/i),$calc($token(%nc,0,32) * $iif($token($uno.hash(%n),0,32) < 3,2,1)))+ $token(%nc,0,32)+ ($gettok(%cs,1,45) /1.5)) > %r) var %s = $gettok(%cs,2,45),%c = %nc,%r = $v1
    }
    inc %a
  }
  if (!%c) || (($token($uno.hash(%n),0,32) < 3) && (WD4 isin $uno.hash($me))) {
    if (*W* iswm $uno.hash($me)) {
      var %ct = $sorttok($+($count(%l,B),-B) $+($count(%l,G),-G) $+($regex(%l,/\bR/gi),-R) $+($count(%l,Y),-Y),32,nr)
      uno.bot.msg $1 play $iif($token($uno.hash(%n),0,32) < 3 && WD4 isin $uno.hash($me),WD4,$iif(* W * !iswm $uno.hash($me) && WD4 isin $v2,WD4,W)) $gettok($gettok(%ct,1,32),2,45)
    }
    elseif (!$uno.hash(draw)) uno.bot.msg $1 draw
    else uno.bot.msg $1 pass
  }
  else uno.bot.msg $1 play $iif($token(%c,0,32) > 1,S $right($gettok(%c,1,32),-1) %s,%c)
  echo -s $str(-,30)
}
alias uno.bot.msg {
  if ($uno.set(spambot)) {
    aline @unomsgs bot $1 $uno.set(trigger) $+ $2-
    if (!$timer(unospam)) uno.msg
  }
  else uno.cmd $1 $me $2-
}
alias uno.hash return $hget(uno,$1)
alias uno.cards {
  if ($prop == sort) && ($uno.set(sortcards)) tokenize 46 $sorttok($regsubex($1,/\bw(d4)?\b/gi,),32) $sorttok($regsubex($1,/\b[^\sw]\S\S?\b/gi,),32)
  var %a 1,%r
  while $gettok($1,%a,32) {
    %r = %r $replace($left($v1,1),B,12,G,9,R,4,Y,8,W,15) $+ $v1
    inc %a
  }
  return $upper(%r) $+ 14,1
}
alias uno.points {
  if ($1 isnum) return $ini($+(",$scriptdirsettings.ini"),points,$1)
  else {
    if ($left($1,4) == *!*@) tokenize 32 $gettok($1,2-,64)
    if ($prop == rank) {
      window -sln @Ranks
      var %a 1
      while $ini($+(",$scriptdirsettings.ini"),points,%a) {
        aline @Ranks $base($readini($+(",$scriptdirsettings.ini"),points,$v1),10,10,200) $v1
        inc %a
      }
      var %r $ord($calc($line(@Ranks,0) - $fline(@Ranks,* $1,1)+1))
      window -c @Ranks
      return %r
    }
    else return $readini($+(",$scriptdirsettings.ini"),points,$1)
  }
}
alias uno.access {
  if ($address($2,2) == $uno.set(owner)) return
  if ($uno.set($1) == 1) && ($address($2,2) != $uno.set(owner)) return the bot owner
  if ($uno.set($1) == 2) && ($2 isreg $3) return a voice, op
  if ($uno.set($1) == 3) && ($2 !isop $3) return an op, or the bot owner
  if ($uno.set($1) == 4) && (!$uno.set($address($2,2)).admin) return a bot admin, or the bot owner
  if ($uno.set($1) == 5) && ($2 isreg $3) && ($address($2,2) != $uno.set(admin)) return a voice, op, an admin, or the bot owner
  if ($uno.set($1) == 6) && ($2 !isop $3) && ($address($2,2) != $uno.set(admin)) return an op, an admin, or the bot owner
}
alias uno.help return $readini($+(",$scriptdirsettings.ini"),help,$1)