Administrators chain Posted August 20, 2020 Administrators Report Share Posted August 20, 2020 ;=========================================================================== ; UNO v1.9 - by entropy 2020 ;=========================================================================== ; Credits: Other UNO games, for the commands and syntax, special thanks to ; Talon, Raccoon, ^^D`Jet^^, Addast, August^ and many other helpful ; people in #unoland UnderNet (beta testing). ;=========================================================================== ; To start a game, you must specify %unochannel and %unonet ; For full list of commands, type: !unocmds ; UNO Commands: !uno !stop !remove !version !unorules !unocmds ; UNO Stats: !unotop10 !unoscore ; UNO Card Commands: jo=join pl=play dr=draw pa=pass ; UNO Chan Commands: ca=cards ct=count tu=turn or=order cd=card ti=time ; UNO play wild: pl w <color> - or: pl wd4 <color> ;=========================================================================== alias -l sversion { return v1.9 } alias -l sauthor { return entropy } alias -l syear { return 2020 } on *:load:{ if ($version < 7.55) { echo $color(info) -ta [UNO] $chr(9679) UNO $sversion needs mIRC >= 7.55! | .unload -rs $qt($script) } else { %uno = off | echo $color(info) -ta [UNO] $chr(9679) UNO $sversion loaded - by $sauthor $syear } } on *:unload:{ echo $color(info) -ta [UNO] $chr(9679) UNO $sversion unloaded... if (%uno == on) { cleanuphand } unset %uno %unochannel %unonet } menu channel,query,menubar,status { - &UNO $sversion .UNO Status $chr(9) $iif($group(#uno).status == on,On,Off) { $iif($group(#uno).status == on,.disable,.enable) #uno | echo $color(info) -tag $chr(9679) [UNO] UNO status is now: $replace($group(#uno).status,o,O) } .- .UNO Top10 { if ($exists($qt($scriptdirunoscores.txt))) { run $qt($scriptdirunoscores.txt) } | else { echo $color(info) -tag $chr(9679) [UNO] No scores file found! } } .- .Channel $chr(9) %unochannel { %unochannel = $input(Channel?,5) | echo $color(info) -tag $chr(9679) [UNO] UNO channel is now: %unochannel } .Network $chr(9) %unonet { %unonet = $input(Network?,5) | echo $color(info) -tag $chr(9679) [UNO] UNO network is now: %unonet } .- .Advertise { var %a = 1 while ($scon(%a)) { scid $v1 if ($network == %unonet && $me ison %unochannel) { describe %unochannel is using: UNO $sversion - by $sauthor $syear - https://mircscripts.net/jbdpI | break } inc %a } scid -r } - } #uno on on *:input:%unochannel:{ if (/* !iswm $1 && $server && $network == %unonet) { douno # $me $1- } } on *:text:*:%unochannel:{ if ($network == %unonet) { douno # $nick $1- } } #uno end alias -l cleanuphand { unset %last.* unset %draw.* unset %*.hand unset %uno.* %uno = off .timeruno* off } on *:kick:%unochannel:{ if ($network == %unonet && %uno == on) { if ($istok(%uno.players,$knick,32)) { msg %unochannel $knick has left the UNO game! %uno.players = $remtok(%uno.players,$knick,1,32) %uno.discard = $eval($+(%,$knick,.hand),3) %uno.discard unset $eval($+(%,$knick,.hand),1) if (%uno.turn == $knick) { skip } if ($numtok(%uno.players,32) <= 1) { cleanuphand msg %unochannel Not enough players to play UNO! msg %unochannel [UNO] $chr(9679) UNO is now Off! } else { playnext } } } } on *:part:%unochannel:{ if ($network == %unonet && %uno == on) { if ($istok(%uno.players,$nick,32)) { msg %unochannel $nick has left the UNO game! %uno.players = $remtok(%uno.players,$nick,1,32) %uno.discard = $eval($+(%,$nick,.hand),3) %uno.discard unset $eval($+(%,$nick,.hand),1) if (%uno.turn == $nick) { skip } if ($numtok(%uno.players,32) <= 1) { cleanuphand msg %unochannel Not enough players to play UNO! msg %unochannel [UNO] $chr(9679) UNO is now Off! } else { playnext } } } } on *:quit:{ if ($nick == $me && %uno == on) { cleanuphand } elseif ($network == %unonet && %uno == on && $nick(%unochannel,$nick)) { if ($istok(%uno.players,$nick,32)) { %uno.players = $remtok(%uno.players,$nick,1,32) msg %unochannel $nick has left the UNO game! %uno.discard = $eval($+(%,$nick,.hand),3) %uno.discard unset $eval($+(%,$nick,.hand),1) if (%uno.turn == $nick) { skip } if ($numtok(%uno.players,32) <= 1) { cleanuphand msg %unochannel Not enough players to play UNO! msg %unochannel [UNO] $chr(9679) UNO is now Off! } else { playnext } } } } on *:nick:{ if ($network == %unonet && %uno == on && $nick(%unochannel,$newnick)) { if ($istok(%uno.players,$nick,32)) { %uno.players = $replace(%uno.players,$nick,$newnick) set $eval($+(%,$newnick,.hand),1) $eval($+(%,$nick,.hand),3) unset $eval($+(%,$nick,.hand),1) if (%uno.turn == $nick) { %uno.turn = $newnick | skip | playnext } } } } ; By Talon alias -l sorthand { return $regsubex($sorttok($regsubex($1-,/([^ ]+)/g,$findtok($thedeck,\t,1,32)),32,n),/(\d+)/g,$gettok($thedeck,\t,32)) } alias -l thedeck { return r0 r1 r1 r2 r2 r3 r3 r4 r4 r5 r5 r6 r6 r7 r7 r8 r8 r9 r9 rr rr rd2 rd2 rs rs g0 g1 g1 g2 g2 g3 g3 g4 g4 g5 g5 g6 g6 g7 g7 g8 g8 g9 g9 gr gr gd2 gd2 gs gs b0 b1 b1 b2 b2 b3 b3 b4 b4 b5 b5 b6 b6 b7 b7 b8 b8 b9 b9 br br bd2 bd2 bs bs y0 y1 y1 y2 y2 y3 y3 y4 y4 y5 y5 y6 y6 y7 y7 y8 y8 y9 y9 yr yr yd2 yd2 ys ys w w w w wd4 wd4 wd4 wd4 } alias -l cards { %uno.allcards = r0 r1 r1 r2 r2 r3 r3 r4 r4 r5 r5 r6 r6 r7 r7 r8 r8 r9 r9 rr rr rd2 rd2 rs rs g0 g1 g1 g2 g2 g3 g3 g4 g4 g5 g5 g6 g6 g7 g7 g8 g8 g9 g9 gr gr gd2 gd2 gs gs b0 b1 b1 b2 b2 b3 b3 b4 b4 b5 b5 b6 b6 b7 b7 b8 b8 b9 b9 br br bd2 bd2 bs bs y0 y1 y1 y2 y2 y3 y3 y4 y4 y5 y5 y6 y6 y7 y7 y8 y8 y9 y9 yr yr yd2 yd2 ys ys w w w w wd4 wd4 wd4 wd4 shuffle.cards } ; By Talon alias -l shuffle.cards { if (%uno == on) { msg %unochannel Shuffling cards... } var %a = %uno.allcards, %b while (%a) { var %c = $r(1,$numtok(%a,32)) , %b = %b $gettok(%a,%c,32) , %a = $deltok(%a,%c,32) } %uno.allcards = %b } ; By Talon alias -l shuffle.discard { var %a = $gettok(%uno.discard,1--2,32), %b while (%a) { var %c = $r(1,$numtok(%a,32)) , %b = %b $gettok(%a,%c,32) , %a = $deltok(%a,%c,32) } %uno.discard = $gettok(%uno.discard,-1,32) %uno.allcards = %b } alias -l drawcard { var %a = $gettok(%uno.allcards,1,32) %uno.allcards = $gettok(%uno.allcards,2-,32) if (!%uno.allcards) { shuffle.discard } return %a } alias -l getcards { return $drawcard $drawcard $drawcard $drawcard $drawcard $drawcard $drawcard } alias -l colorize { var %a = 1, %b, %t while ($gettok($1-,%a,32)) { %b = $upper($v1) if (r* iswm %b) { %t = %t $+($chr(3),00,$chr(44),04,[,%b,],$chr(3)) } elseif (b* iswm %b) { %t = %t $+($chr(3),00,$chr(44),12,[,%b,],$chr(3)) } elseif (g* iswm %b) { %t = %t $+($chr(3),00,$chr(44),03,[,%b,],$chr(3)) } elseif (y* iswm %b) { %t = %t $+($chr(3),01,$chr(44),08,[,%b,],$chr(3)) } elseif (w* iswm %b) { if (%b == wd4 || %b == w) { if (%uno.wildcolor) { var %s = $v1 var %col = $replace(%s,r,04,b,12,g,03,y,08) if (%col == 04) { %t = %t $+($chr(3),00,$chr(44),%col,[,%b,],$chr(3)) } if (%col == 03) { %t = %t $+($chr(3),00,$chr(44),%col,[,%b,],$chr(3)) } if (%col == 12) { %t = %t $+($chr(3),00,$chr(44),%col,[,%b,],$chr(3)) } if (%col == 08) { %t = %t $+($chr(3),01,$chr(44),%col,[,%b,],$chr(3)) } } else { %t = %t $+($chr(3),00,$chr(44),01,[,%b,],$chr(3)) } } } inc %a } return %t } alias -l colorize2 { var %a = 1, %b, %t while ($gettok($1-,%a,32)) { %b = $upper($v1) if (r* iswm %b) { %t = %t $+($chr(3),00,$chr(44),04,[,%b,],$chr(3)) } elseif (b* iswm %b) { %t = %t $+($chr(3),00,$chr(44),12,[,%b,],$chr(3)) } elseif (g* iswm %b) { %t = %t $+($chr(3),00,$chr(44),03,[,%b,],$chr(3)) } elseif (y* iswm %b) { %t = %t $+($chr(3),01,$chr(44),08,[,%b,],$chr(3)) } elseif (%b == wd4 || %b == w) { %t = %t $+($chr(3),00,$chr(44),01,[,%b,],$chr(3)) } inc %a } return %t } alias -l startuno { if ($numtok(%uno.players,32) < 2) { msg %unochannel Not enough players to play UNO! msg %unochannel [UNO] $chr(9679) UNO is now Off! cleanuphand return } %uno.time = $ctime %uno = on :set var %u = $drawcard if (*s iswm %u || *r iswm %u || wd4 == %u || *d2 iswm %u || w == %u) { %uno.allcards = %uno.allcards %u | goto set } else { %uno.topcard = %u } %uno.turn = $gettok(%uno.players,1,32) %uno.direction = right var %c = $eval($+(%,%uno.turn,.hand),3) $+(.timerunotest,1) -o 1 1 .notice %uno.turn Hand: $colorize2($sorthand(%c)) %uno.top = $colorize(%uno.topcard) msg %unochannel [UNO] $chr(9679) UNO Game has started! msg %unochannel It is now %uno.turn $+ 's turn! Playing on: %uno.top .timerunonext -o 1 60 nextplayer .timerunostart off } alias -l nextplayer { msg %unochannel %uno.turn has been skipped for not playing after 1 minute! skip msg %unochannel It is now %uno.turn $+ 's turn! Playing on: %uno.top var %a = 1, %b, %c while ($gettok(%uno.players,%a,32)) { %b = $v1 if (%b != %uno.turn) { %c = %c $+(%b,:,$numtok($eval($+(%,%b,.hand),3),32)) } inc %a } .timerunonotice $+ %uno.turn -o 1 1 .notice %uno.turn Hand: $colorize2($sorthand($eval($+(%,%uno.turn,.hand),3))) .timerunonext -o 1 60 nextplayer } alias -l skip { if (%uno.direction == left) { var %s = $findtok(%uno.players,%uno.turn,1,32) if (%s == 1) { %s = $numtok(%uno.players,32) } else { dec %s 1 } if ($gettok(%uno.players,%s,32)) { %uno.turn = $v1 } } else { var %s = $findtok(%uno.players,%uno.turn,1,32) if (%s == $numtok(%uno.players,32)) { %s = 1 } else { inc %s 1 } if ($gettok(%uno.players,%s,32)) { %uno.turn = $v1 } } } alias -l playnext { if (%uno == off) { return } msg %unochannel It is now %uno.turn $+ 's turn! Playing on: %uno.top var %a = 1, %b, %c while ($gettok(%uno.players,%a,32)) { %b = $v1 if (%b != %uno.turn) { %c = %c $+(%b,:,$numtok($eval($+(%,%b,.hand),3),32)) } inc %a } .timerunonotice $+ %uno.turn -o 1 1 .notice %uno.turn Hand: $colorize2($sorthand($eval($+(%,%uno.turn,.hand),3))) .timerunonext -o 1 60 nextplayer } alias -l douno { var %nick = $2, %channel = $1 tokenize 32 $3- if (?uno iswm $1 && $left($1,1) isin @!.) { if (%uno == on || %uno.players) { msg %unochannel UNO is already On! } else { cleanuphand cards msg %unochannel [UNO] $chr(9679) UNO is now On! %uno.direction = right .timerunostart -o 1 30 startuno msg %unochannel UNO starts in 30 seconds. Type: "jo" to join. %uno.players = %uno.players %nick var %c = $getcards set $eval($+(%,%nick,.hand),1) %c msg %unochannel %nick has joined UNO! .notice %nick UNO Commands: !unocmds } } elseif (?stop iswm $1 && $left($1,1) isin @!.) { if (!%uno.players) { msg %unochannel UNO is already Off! } elseif (!$istok(%uno.players,%nick,32)) { msg %unochannel You can only stop the game if you are currently playing! } else { cleanuphand %uno = off if (%uno.time) { msg %unochannel Uno was played for: $duration($calc($ctime - %uno.time)) } msg %unochannel [UNO] $chr(9679) UNO is now Off! unset %uno.time } } elseif (?unoscore iswm $1 && $left($1,1) isin @!.) { var %az = $qt($scriptdirunoscores.txt) if (!$2) { var %n = $iif($read(%az,nw,* %nick),$ord($readn)) } else { var %n = $iif($read(%az,nw,* $2),$ord($readn)) } msg %unochannel $iif($2,$2 has:,You have:) $iif($gettok($read(%az,nw,* $iif(!$2,%nick,$2)),1,32),$bytes($v1,b),0) points! $iif(%n,$+($chr(40),%n,$chr(41))) } elseif (?unotop10 iswm $1 && $left($1,1) isin @!.) { var %az = $qt($scriptdirunoscores.txt) if (!$read(%az,n,1)) { msg %unochannel [UNO] $chr(9679) No scores! | return } var %a = 1, %b, %total while (%a <= $lines(%az)) { %b = $read(%az,n,%a) var %x = $gettok(%b,1,32) var %x2 = $gettok(%b,2,32) if (%a <= 10) { %total = %total ( $+ $ord(%a) $+ ) $nohi(%x2) $chr(91) $+ $bytes(%b,b) $+ $chr(93) $chr(9679) } inc %a } msg %unochannel [UNO Top10] $chr(9679) $gettok(%total,1--1,9679) } elseif (?remove iswm $1 && $left($1,1) isin @!.) { if (%uno == on && $istok(%uno.players,%nick,32) && %uno.turn) { msg %unochannel %nick has left the UNO game! %uno.players = $remtok(%uno.players,%nick,1,32) unset $eval($+(%,%nick,.hand),1) if ($numtok(%uno.players,32) <= 1) { cleanuphand msg %unochannel Not enough players to play UNO! if (%uno.time) { msg %unochannel Uno was played for: $duration($calc($ctime - %uno.time)) } msg %unochannel [UNO] $chr(9679) UNO is now Off! unset %uno.time return } if (%uno.turn == %nick) { skip } playnext } } elseif (tu == $1) { if (%uno == on) { msg %unochannel It is: %uno.turn $+ 's turn! } } elseif (or == $1) { if (%uno == on) { var %a = 1, %b, %all = %uno.players while ($gettok(%all,%a,32) != $null) { %b = $v1 if (%uno.turn == %b) { %all = $replace(%all,%b,$+($chr(31),%b,$chr(31))) } inc %a } msg %unochannel Order: $iif(%uno.direction == left,[<],[>]) $nohi(%all) } } elseif (?unorules iswm $1 && $left($1,1) isin @!.) { .notice %nick UNO Rules: https://service.mattel.com/instruction_sheets/42001pr.pdf } elseif (?version iswm $1 && $left($1,1) isin @!.) { describe %unochannel is using: UNO $sversion - by $sauthor $syear - https://mircscripts.net/jbdpI } elseif (?unocmds iswm $1 && $left($1,1) isin @!.) { .timercmds1 -o 1 1 .notice %nick UNO Commands: !uno !stop !remove !version !unorules !unocmds .timercmds2 -o 1 1 .notice %nick UNO Stats: !unotop10 !unoscore .timercmds3 -o 1 1 .notice %nick UNO Card Commands: jo=join pl=play dr=draw pa=pass .timercmds4 -o 1 1 .notice %nick UNO Chan Commands: ca=cards ct=count tu=turn or=order cd=card ti=time .timercmds5 -o 1 1 .notice %nick UNO play wild: pl w <color> - or: pl wd4 <color> } elseif (jo == $1) { if (%uno == on && $numtok(%uno.players,32) >= 10) { msg %unochannel UNO Maximum of 10 players playing! Please wait untill the next game to join. } elseif ($istok(%uno.players,%nick,32)) { msg %unochannel You have already joined! } elseif (%uno == on) { msg %unochannel Game in progress. Please wait untill next game to play. } elseif (%uno.players) { %uno.players = %uno.players %nick var %c = $getcards set $eval($+(%,%nick,.hand),1) %c msg %unochannel %nick has joined UNO! .notice %nick UNO Commands: !unocmds .timerunostart -o 1 30 startuno } else { msg %unochannel No game in progress! } } elseif (ca == $1) { if (!$istok(%uno.players,%nick,32)) { return } .timerunonotice $+ %nick -o 1 1 .notice %nick Hand: $colorize2($sorthand($eval($+(%,%nick,.hand),3))) } elseif (cd == $1) { if (%uno == off) { return } .notice %nick Playing on: $colorize(%uno.topcard) } elseif (ti == $1) { if (%uno == off) { return } elseif (%uno.time) { msg %unochannel Uno has been playing for: $duration($calc($ctime - %uno.time)) } } elseif (ct == $1) { if (!$istok(%uno.players,%nick,32) || %uno == off) { return } var %a = 1, %b, %c, %to = [UNO Cards] $chr(9679) while ($gettok(%uno.players,%a,32)) { %b = $v1 %c = $eval($+(%,%b,.hand),3) %to = %to %b $+([,$numtok(%c,32),]) $chr(9679) inc %a } if (%to) { .timerunonoticex $+ %nick -o 1 1 msg $unsafe( %unochannel ) $nohi($gettok(%to,1--1,9679)) } } elseif (dr == $1) { if (%uno == off) { return } elseif (%uno.turn != %nick) { msg %unochannel Not your turn! } elseif ($eval($+(%,last.,%uno.turn),3)) { msg %unochannel You already drew! } else { var %r = $drawcard set $eval($+(%,%uno.turn,.hand),1) $eval($+(%,%uno.turn,.hand),3) %r msg %unochannel %uno.turn draws! var %a = 1, %b, %c while ($gettok(%uno.players,%a,32)) { %b = $v1 if (%b != %uno.turn) { %c = %c $+(%b,:,$numtok($eval($+(%,%b,.hand),3),32)) } inc %a } .timerdraw $+ %uno.turn -o 1 1 .notice %uno.turn You drew: $colorize2(%r) .timerdraw2 $+ %uno.turn -o 1 1 .notice %uno.turn Hand: $colorize2($sorthand($eval($+(%,%uno.turn,.hand),3))) set $eval($+(%,last.,%uno.turn),1) $ctime set $eval($+(%,draw.,%uno.turn),1) %r .timerunonext -o 1 60 nextplayer } } elseif (pa == $1) { if (%uno == off) { return } elseif (%uno.turn != %nick) { msg %unochannel Not your turn! } elseif (!$eval($+(%,last.,%uno.turn),2)) { msg %unochannel You have not drawn yet! } else { var %c = %uno.turn msg %unochannel %uno.turn passes! unset $eval($+(%,last.,%uno.turn),1) unset $eval($+(%,draw.,%uno.turn),1) skip unset $eval($+(%,last.,%uno.turn),1) unset $eval($+(%,draw.,%uno.turn),1) msg %unochannel it is now %uno.turn $+ 's turn! Playing on: %uno.top var %a = 1, %b, %c while ($gettok(%uno.players,%a,32)) { %b = $v1 if (%b != %uno.turn) { %c = %c $+(%b,:,$numtok($eval($+(%,%b,.hand),3),32)) } inc %a } .timerunonotice $+ %uno.turn -o 1 1 .notice %uno.turn Hand: $colorize2($sorthand($eval($+(%,%uno.turn,.hand),3))) .timerunonext -o 1 60 nextplayer } } elseif (pl == $1) { if (%uno == off) { return } elseif (!$2) { msg %unochannel No card specified! } elseif (%uno.turn != %nick) { msg %unochannel Not your turn! } else { var %d = $eval($+(%,draw.,%uno.turn),3) if (%d && %d != $2) { msg %unochannel You may only play the card you drew! .notice %uno.turn You drew: $colorize2(%d) } elseif ($istok($eval($+(%,%nick,.hand),3),$2,32)) { if ($2 == wd4 || $2 == w) { if ($2 == wd4 && $canplay(%uno.turn,%uno.topcard)) { msg %unochannel You must play the cards you can play before playing a wild draw 4! return } if (!$3) { msg %unochannel No color selected! | return } elseif (!$istok(red blue green yellow,$3,32) && !$istok(r b g y,$3,32)) { msg %unochannel Invalid color selected! Available: red blue green yellow | return } else { %uno.wildcolor = $left($3,1) } } ;CHECK TO SEE IF YOU CAN PLAY THE CARD! var %a = %uno.topcard var %x = $+($left(%a,1),*) var %col = %uno.wildcolor if (*d2 iswm %a) { var %y = *d2 } elseif (%a == wd4 || %a == w) { var %y = $+(%col,*) } else { var %y = $+(*,$mid(%a,2)) } if (%a == wd4 || %a == w) { if (%col != $left($2,1)) { if (wd4 != $2 && w != $2) { msg %unochannel Cannot play this card! return } } } elseif ($mid($2,2) == d2 && $mid(%a,2) == 2) || ($mid($2,2) == 2 && $mid(%a,2) == d2) { if (wd4 != $2 && w != $2) { msg %unochannel Cannot play this card! return } } elseif ($mid(%a,2) == d2) { if ($+($left($2,1),*) !iswm %x && *d2 !iswm $2) { if (wd4 != $2 && w != $2) { msg %unochannel Cannot play this card! return } } } elseif (%x !iswm $2 && %y !iswm $2) { if (wd4 != $2 && w != $2) { msg %unochannel Cannot play this card! return } } ;========================= var %hand = $eval($+(%,%uno.turn,.hand),2) var %a = $remtok(%hand,$2,1,32) if (%a) { set $eval($+(%,%uno.turn,.hand),1) %a } else { unset $eval($+(%,%uno.turn,.hand),1) } %uno.discard = %uno.discard $2 ;========================= ;UNO! if ($numtok($eval($+(%,%uno.turn,.hand),3),32) == 1) { msg %unochannel %uno.turn declares UNO! } ;END OF HAND! elseif (!$eval($+(%,%uno.turn,.hand),3)) { var %active = %uno.turn if ($2 == wd4) { skip set $eval($+(%,%uno.turn,.hand),1) $eval($+(%,%uno.turn,.hand),3) $drawcard $drawcard $drawcard $drawcard } elseif (*d2 iswm $2) { skip set $eval($+(%,%uno.turn,.hand),1) $eval($+(%,%uno.turn,.hand),3) $drawcard $drawcard } %uno.turn = %active .timeruno* off msg %unochannel %uno.turn has played all their cards! msg %unochannel [UNO] Standings: var %a = 1, %b, %c = 0, %points = 0, %d, %hand while ($gettok(%uno.players,%a,32)) { %b = $v1 if (%b != %nick) { inc %c .timer -o 1 %c msg $unsafe( %unochannel ) %b $+ : $colorize2($sorthand($eval($+(%,%b,.hand),3))) %hand = $eval($+(%,%b,.hand),3) var %x = 1 while ($gettok(%hand,%x,32)) { %d = $v1 if (*d2 iswm %d || *r iswm %d || *s iswm %d) { inc %points 20 } elseif (w == %d || wd4 == %d) { inc %points 50 } else { var %g = $remove(%d,r,b,g,y) if (%g isnum) { inc %points %g } } inc %x } } inc %a } .timer -o 1 %c msg $unsafe( %unochannel ) Total UNO Points this round: $bytes(%points,b) var %p = $gettok($read($qt($scriptdirunoscores.txt),wn,* %nick),1,32) if (%p == $null) { %p = 0 } inc %p %points unostats %p %nick var %n = $readn if (%uno.time) { .timer -o 1 %c msg $unsafe( %unochannel ) Uno was played for: $duration($calc($ctime - %uno.time)) } .timer -o 1 %c msg $unsafe( %unochannel ) %nick now has: $bytes(%p,b) points! $iif(%n != 0,$+($chr(40),$ord(%n),$chr(41))) cleanuphand unset %uno.time return } :cardcheck ; CARD LISTINGS if (*r iswm $2) { %uno.direction = $iif(%uno.direction == left,right,left) msg %unochannel Game direction reversed to: $replace(%uno.direction,left,[<] Left,right,[>] Right) if ($numtok(%uno.players,32) == 2) { %uno.turn = %nick } else { skip } goto uno } elseif (*s iswm $2) { skip msg %unochannel $nohi(%uno.turn) was skipped... } elseif ($2 == wd4) { skip set $eval($+(%,%uno.turn,.hand),1) $eval($+(%,%uno.turn,.hand),3) $drawcard $drawcard $drawcard $drawcard msg %unochannel $nohi(%uno.turn) was skipped and dealt 4 cards... .notice %uno.turn Hand: $colorize2($sorthand($eval($+(%,%uno.turn,.hand),3))) } elseif (*d2 iswm $2) { skip set $eval($+(%,%uno.turn,.hand),1) $eval($+(%,%uno.turn,.hand),3) $drawcard $drawcard msg %unochannel $nohi(%uno.turn) was skipped and dealt 2 cards... .notice %uno.turn Hand: $colorize2($sorthand($eval($+(%,%uno.turn,.hand),3))) } skip :uno %uno.topcard = $2 %uno.top = $colorize(%uno.topcard) unset $eval($+(%,last.,%uno.turn),1) unset $eval($+(%,draw.,%uno.turn),1) playnext } else { msg %unochannel You don't have that card! } } } } ctcp *:VERSION:?:{ .ctcpreply $nick VERSION UNO $sversion - by $sauthor $syear - https://mircscripts.net/jbdpI } alias -l canplay { ;$canplay(person,card_on_top) if (!$2 || %uno == off) { return } var %a = 1, %b, %c = $eval($+(%,$1,.hand),3), %d, %e while ($gettok(%c,%a,32)) { %b = $v1 if (*d2 iswm %b) { %d = $+($left(%b,1),*) %e = $+(*,$right(%b,2)) } elseif (wd4 != %b && w != %b) { %d = $+($left(%b,1),*) %e = $+(*,$right(%b,1)) } if (%d && %e) { if (%d iswm $2 || %e iswm $2) { return $true } } inc %a } return $false } alias -l unostats { ;/unostats <N> <nick> if ($istok(%nostats,$2,32)) { return } var %az = $qt($scriptdirunoscores.txt) if (!$exists(%az)) { write -c %az } var %current = $1 if ($read(%az,wn,* $2)) { write -dl $+ $readn %az } var %a = 1, %b, %added = no, %c while ($read(%az,n,%a)) { %b = $v1 if (%current >= $gettok(%b,1,32)) { write -il $+ %a %az %current $2 | %added = yes | break } inc %a } if (%added == no) { write %az %current $2 } } alias -l nohi { return $regsubex(_nohilite,$1-,/\S\S\K(?=\S)/gu,$chr(8205)) } ; by Raccoon Simple UNO game. Works well. You can play with up to 10 players and it all works seemlessly. To start a game, you must specify %unochannel and %unonet (also make sure the status is "on"). Complete list of commands: !unocmds Link to comment Share on other sites More sharing options...