Snippets Project Page
Author: entropy
Added: 2y
Updated: 2y
mIRC: 7.55+
Hits: 883
Downloads: 39
Review: westor
Size: 63.82KB
1 0
Login to vote.
UNO BOT
v3.1
This is a UNO bot i made some time ago. It works really well. Load it, then right click in the status window or channel and set the UNO channel and network. Then type: !uno or !unobot (to play against a bot) in this chanel. This bot doesn't work if you are the one running the bot and trying to play (just a heads up).
Download
JSON
▲ Review
▼ Source
;=========================================================================== ; UNO v3.1 - by entropy 2021 (8/26/21) ;=========================================================================== ; 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). ; Added a !unobot command to play against the bot. ;=========================================================================== ; To start a game, you must specify %unochannel and %unonet ; For full list of commands, type: !unocmds ; UNO Admin Commands: !botplays !botpoints !botnotice !botcolor !botmid !skip !addadmin !deladmin ; UNO Commands: !uno !stop !remove !version !unorules !unocmds !bestpoints !besttime !last ; UNO Stats: !unotop10 !unotop10wins !points !wins ; 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> ; UNO play the bot: !unobot ;=========================================================================== alias -l sversion { return v3.1 } alias -l sauthor { return entropy } alias -l syear { return 2021 } on !*:join:%unochannel:{ if (%unojoin == yes && %unonet == $network) { set -u3 %_snick $nick .timerunojoinwelcome -o 1 1 .notice $nick $+([,%unochannel,]) Welcome to %unochannel on %unonet $+ ! Type: !unocmds for commands. $iif(%uno.players,Game in progress: $duration($calc($ctime - %uno.time)),No game in progress!) .timerunojoin -o 1 2 .notice $nick $+([,%unochannel,]) $allstats(points,$nick,1) .timerunojoin2 -o 1 3 .notice $nick $+([,%unochannel,]) $allstats(wins,$nick,1) if ($isuser($fulladdress)) { mode # +o $nick } } } on *:load:{ if ($version < 7.55) { echo $color(info) -tag [UNO] $chr(9679) UNO $sversion needs mIRC >= 7.55! | .unload -rs $qt($script) } else { if (!$isdir($qt($scriptdiruno))) { mkdir $qt($scriptdiruno) } | cleanuphand | %unobot = yes | %unopoints = no | echo $color(info) -tag [UNO] $chr(9679) UNO $sversion loaded - by $sauthor $syear } } on *:unload:{ echo $color(info) -tag [UNO] $chr(9679) UNO $sversion unloaded... cleanuphand unset %uno %unochannel %unonet %unocolor %unolast %unobot %unopoints %unojoin %unoadmins %unobesttime %unobestpoints %unoworsttime if ($input(Would you like to remove all UNO files?,8)) { cleanupfiles } } on *:start:{ if (!$isdir($scriptdiruno)) { mkdir $qt($scriptdiruno) } } 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 Scores ..All Time $chr(9) $lines($qt($scriptdiruno/unoscores.txt)) { if ($exists($qt($scriptdiruno/unoscores.txt))) { run $qt($scriptdiruno/unoscores.txt) } | else { write -c $qt($scriptdiruno/unoscores.txt) | run $qt($scriptdiruno/unoscores.txt) } } ..This Month's $chr(9) $lines($qt($+($scriptdiruno/unoscores,.,$gettok($adate,1,47),.,$gettok($adate,3,47),.txt))) { var %file = $qt($+($scriptdiruno/unoscores,.,$gettok($adate,1,47),.,$gettok($adate,3,47),.txt)) if ($exists(%file)) { run %file } else { write -c %file | run %file } } ..Today's $chr(9) $lines($qt($+($scriptdiruno/unoscores,.,$gettok($adate,1,47),.,$gettok($adate,2,47),.,$gettok($adate,3,47),.txt))) { var %file = $qt($+($scriptdiruno/unoscores,.,$gettok($adate,1,47),.,$gettok($adate,2,47),.,$gettok($adate,3,47),.txt)) if ($exists(%file)) { run %file } else { write -c %file | run %file } } .UNO Wins ..All Time $chr(9) $lines($qt($scriptdiruno/unowins.txt)) { if ($exists($qt($scriptdiruno/unowins.txt))) { run $qt($scriptdiruno/unowins.txt) } | else { write -c $qt($scriptdiruno/unoscores.txt) | run $qt($scriptdiruno/unoscores.txt) } } ..This Month's $chr(9) $lines($qt($+($scriptdiruno/unowins,.,$gettok($adate,1,47),.,$gettok($adate,3,47),.txt))) { var %file = $qt($+($scriptdiruno/unowins,.,$gettok($adate,1,47),.,$gettok($adate,3,47),.txt)) if ($exists(%file)) { run %file } else { write -c %file | run %file } } ..Today's $chr(9) $lines($qt($+($scriptdiruno/unowins,.,$gettok($adate,1,47),.,$gettok($adate,2,47),.,$gettok($adate,3,47),.txt))) { var %file = $qt($+($scriptdiruno/unowins,.,$gettok($adate,1,47),.,$gettok($adate,2,47),.,$gettok($adate,3,47),.txt)) if ($exists(%file)) { run %file } else { write -c %file | run %file } } .- .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 } .- .Other Settings ..Advertise { var %a = 1 while ($scon(%a)) { scid $v1 if ($network == %unonet && $me ison %unochannel) { describe %unochannel is using: UNO $sversion - by $sauthor $syear | break } inc %a } scid -r } ..- ..$iif(%unopoints == yes,$style(1)) Bot Points { %unopoints = $iif(%unopoints == yes,no,yes) | echo $color(info) -tag $chr(9679) [UNO] Bot points are now: %unopoints } ..- ..$iif(%unobot == yes,$style(1)) Bot Plays Status { %unobot = $iif(%unobot == yes,no,yes) | echo $color(info) -tag $chr(9679) [UNO] Bot plays status is now: %unobot } ..- ..$iif(%unojoin == yes,$style(1)) Onjoin Notice { %unojoin = $iif(%unojoin == yes,no,yes) | echo $color(info) -tag $chr(9679) [UNO] Bot onjoin notice is now: %unojoin } ..- ..$iif(%unomid == yes,$style(1)) Join mid game { %unomid = $iif(%unomid == yes,no,yes) | echo $color(info) -tag $chr(9679) [UNO] Join mid game is now: %unomid } ..- ..Message Color $chr(9) %unocolor { var %a = $input(Color?,5) | %unocolor = %a | echo $color(info) -tag $chr(9679) [UNO] Message Color is now: $iif(%a,$v1,None) } ..- ..Unload { if ($input(Are you sure you want to unload UNO?,8)) { cleanuphand | .unload -rs $qt($mircdiruno.mrc) } } - } ; ADMIN BIT on me:*:join:#:{ .timer 1 4 checkial # } menu nicklist { - UNO Admin List .$iif($snick($active,0) > 1,Add $snick($active,0) Selected Nicks To Admin List) ..$submenu($GenerateMultiMasks($1)) .$iif($snick($active,0) == 1,Add Selected Nick To Admin List) ..$iif($remove($gettok($address($1,5),2,64),.) isnum,IP Admin) ...Mask 1 - $mask1 { addadmin $mask1 } ...Mask 2 - $mask2 { addadmin $mask2 } ...Mask 3 - $mask3 { addadmin $mask3 } ..- ..$submenu($GenerateMasks($1)) .- .$iif($ulist($address($$1,5),admin,1) && $snick($active,0) == 1,Delete from Admin List) { var %a = 1, %b = 0 | while ($ulist($address($$1,5),admin,1)) { inc %b | .ruser admin $v1 } | echo -tag * Admin List cleared of: %b item $+ $iif(%b != 1,s) $+ ! } .- .$iif($ulist(*,admin,1),Clear Admin List) { var %r = $ulist(*,admin,0) | .rlevel admin | echo -tag * Admin List cleared of: %r item $+ $iif(%r != 1,s) $+ ! } .- - } alias f2 { addadmin } alias -l checkial { if (!$chan($1).ial && $me ison $1) { .ialfill $1 } } alias -l getaddr { return $mask($address($snick($active,1),5),4) } alias -l mask1 { return $deltok($getaddr,2-3,46) } alias -l mask2 { return $deltok($getaddr,3,46) } alias -l mask3 { return $+($deltok($getaddr,4,46),.*) } alias -l dummyhost { return $mask(test!test@127.0.0.1,$1) } alias -l appendaddress { var %a = 1, %b | while ($snick($active,%a)) { %b = $v1 | addadmin $address(%b,$1) | inc %a } } alias -l GenerateMasks { if ($1 == begin || $1 == end) { return - } elseif ($1 isnum 1-12) { var %lvl = $1 - 1, %addy = $address($snick($active,1),%lvl) if (%addy) { return Mask %lvl - %addy : addadmin %addy } } } alias -l GenerateMultiMasks { if ($1 == begin || $1 == end) { return - } elseif ($1 isnum 1-12) { var %lvl = $1 - 1 return Mask %lvl - $dummyhost(%lvl) : appendaddress %lvl } } alias -l addadmin { if ($1 == $null) { tokenize 32 $input(Host to admin?,5) } if ($! || $1 != $null) { var %n = $v1, %total = $ulist(*,admin,0) | .auser admin %n | if (%total != $ulist(*,admin,0)) { echo -tag * $+([,$ulist(*,admin,0),]) Added UNO Admin: $qt(%n) } } else { echo -tag * Nothing to add! } } #uno on 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 *:disconnect:{ if ($network == %unonet) { cleanuphand } } on *:kick:%unochannel:{ if ($network == %unonet && %uno.players) { if ($istok(%uno.players,$knick,32)) { smsg %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 smsg %unochannel Not enough players to play UNO! smsg %unochannel [UNO] $chr(9679) UNO is now Off! } else { playnext } } } } on *:part:%unochannel:{ if ($network == %unonet && %uno.players) { if ($istok(%uno.players,$nick,32)) { smsg %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 smsg %unochannel Not enough players to play UNO! smsg %unochannel [UNO] $chr(9679) UNO is now Off! } else { playnext } } } } on *:quit:{ if ($nick == $me && %uno.players) { cleanuphand } elseif ($network == %unonet && $nick(%unochannel,$nick)) { if ($istok(%uno.players,$nick,32)) { %uno.players = $remtok(%uno.players,$nick,1,32) smsg %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 smsg %unochannel Not enough players to play UNO! smsg %unochannel [UNO] $chr(9679) UNO is now Off! } else { playnext } } } } on *:nick:{ if ($network == %unonet && $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 = $thedeck if (%uno == on) { smsg %unochannel Shuffling cards... } shuffle.cards shuffle.cards shuffle.cards shuffle.cards } ; By Talon alias -l shuffle.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) { smsg %unochannel Not enough players to play UNO! smsg %unochannel [UNO] $chr(9679) UNO is now Off! cleanuphand return } %uno.time = $ctime %uno = on %unolast = $ctime :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) var %a = 1, %b, %d, %t = 1 while ($gettok(%uno.players,%a,32)) { %b = $v1 if (%b != $me) { %d = $eval($+(%,%b,.hand),3) $+(.timerunostarthand,%a) -o 1 %t .notice %b Hand: $colorize2($sorthand(%d)) inc %t } inc %a } %uno.top = $colorize(%uno.topcard) smsg %unochannel [UNO] $chr(9679) UNO Game has started! smsg %unochannel Players this round: $+([,$numtok(%uno.players,32),]) smsg %unochannel It is now $+($chr(2),%uno.turn,$chr(2)) $+ 's turn! Playing on: $colorize(%uno.topcard) .timerunonext -o 1 60 nextplayer .timerunostart off } alias -l nextplayer { smsg %unochannel %uno.turn has been skipped for not playing after 1 minute! skip smsg %unochannel It is now $+($chr(2),%uno.turn,$chr(2)) $+ 's turn! Playing on: $colorize(%uno.topcard) 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 } if (%uno.turn != $me) { .timerunonotice $+ %uno.turn -o 1 1 .notice %uno.turn Hand: $colorize2($sorthand($eval($+(%,%uno.turn,.hand),3))) } else { .timerunobotplay -o 1 6 botplay } .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 } smsg %unochannel It is now $+($chr(2),%uno.turn,$chr(2)) $+ 's turn! Playing on: $colorize(%uno.topcard) if (%uno.turn != $me) { .timerunonotice $+ %uno.turn -o 1 1 .notice %uno.turn Hand: $colorize2($sorthand($eval($+(%,%uno.turn,.hand),3))) } else { .timerunobotplay -o 1 6 botplay } .timerunonext -o 1 60 nextplayer } alias -l isuser { if (!$1) { return } var %a = 1, %b while ($ulist(*,admin,%a)) { %b = $v1 if (%b iswm $1 || $1 iswm %b) { return %b } inc %a } } alias -l douno { var %nick = $2, %channel = $1 tokenize 32 $3- if (?uno iswm $1 && $left($1,1) isin @!.) { if (%uno == on || %uno.players) { smsg %unochannel UNO is already On! } else { cleanuphand cards smsg %unochannel [UNO] $chr(9679) UNO is now On! %uno.direction = right .timerunostart -o 1 30 startuno smsg %unochannel UNO starts in 30 seconds. Type: "jo" to join. %uno.players = %uno.players %nick var %c = $getcards set $eval($+(%,%nick,.hand),1) %c smsg %unochannel $nohi(%nick) has joined UNO! } } elseif (?unobot iswm $1 && $left($1,1) isin @!.) { if (%unobot != yes) { smsg %unochannel UNO bot is disabled! | return } elseif (%uno.players) { smsg %unochannel UNO game in progress! | return } cleanuphand cards smsg %unochannel [UNO] $chr(9679) UNO (bot mode) is now On! %uno.direction = right .timerunostart -o 1 30 startuno smsg %unochannel UNO starts in 30 seconds. Type: "jo" to join. %uno.players = %uno.players %nick var %c = $getcards set $eval($+(%,%nick,.hand),1) %c smsg %unochannel $nohi(%nick) has joined UNO! %uno.players = %uno.players $me var %c = $getcards .timerunostartx -o 1 2 set $eval($+(%,$me,.hand),1) %c .timerunostartx2 -o 1 2 msg %unochannel jo .timerunostartx3 -o 1 2 smsg %unochannel $nohi($me) has joined UNO! } elseif (?admins iswm $1 && $left($1,1) isin @!.) { if ($ulist($address(%nick,5),admin,1)) { .notice %nick UNO Admins: var %file = $qt($mircdiradmins.rtf) write -c %file var %a = 1, %b, %all while ($ulist(*,admin,%a)) { %b = $v1 write -l1 %file $read(%file,n,1) %b inc %a } bset -t &commands 1 $read(%file,1) .remove %file var %a = 1, %b = 10, %t = 1 while ($gettok($bvar(&commands,1-).text,%a - $calc(%a + $calc(%b - 1)),32) != $null) { .timer -o 1 %t .notice %nick $v1 inc %t 2 inc %a %b } } else { smsg %unochannel You are not an UNO admin! } } elseif (?addadmin iswm $1 && $left($1,1) isin @!.) { if ($ulist($address(%nick,5),admin,1)) { if (!$2) { smsg %unochannel No hostmask entered! | return } if (@ !isin $2 && ! !isin $2 && $2 !ison %unochannel) { smsg %unochannel Invalid Hostmask! | return } elseif ($2 ison %unochannel) { var %out = $address($2,5) } else { var %out = $2 } if (!$isuser(%out)) { if (! !isin $2 && @ !isin $2) { var %admin = $mask(%out,12) | .auser admin $mask(%out,12) } else { var %admin = %out | .auser admin %out } smsg %unochannel $nohi(%nick) has added UNO admin: %admin } else { smsg %unochannel $2 is already an UNO admin! } } else { smsg %unochannel You are not an UNO admin! } } elseif (?deladmin iswm $1 && $left($1,1) isin @!.) { if ($ulist($address(%nick,5),admin,1)) { if (!$2) { smsg %unochannel No hostmask entered! | return } if (@ !isin $2 && ! !isin $2 && $2 !ison %unochannel) { smsg %unochannel No such user on channel! | return } if ($2 ison %unochannel) { var %out = $address($2,5) } else { var %out = $2 } if ($isuser(%out)) { var %all = $ulist(*,admin,0), %out = $v1 .ruser admin %out if ($ulist(*,admin,0) != %all) { smsg %unochannel $nohi(%nick) has deleted UNO admin: %out } else { smsg %unochannel No such admin! } } else { smsg %unochannel $2 is not an UNO admin! } } else { smsg %unochannel You are not an UNO admin! } } elseif (?stop iswm $1 && $left($1,1) isin @!.) { if (!%uno.players) { smsg %unochannel UNO is already Off! } else { cleanuphand %uno = off smsg %unochannel [UNO] $chr(9679) UNO is now Off! } } elseif (?last iswm $1 && $left($1,1) isin @!.) { smsg %unochannel Last game of UNO was: $duration($calc($ctime - %unolast)) ago } elseif (?skip iswm $1 && $left($1,1) isin @!.) { if (!$ulist($address(%nick,5),admin,1)) { smsg %unochannel Only admins can skip people! } elseif (%uno != on) { smsg %unochannel No UNO game playing! } else { smsg %unochannel %uno.turn was skipped... | skip | playnext } } elseif (?points iswm $1 && $left($1,1) isin @!.) { set -u2 %_snick %nick smsg %unochannel $allstats(points,$iif($2,$2,%nick)) } elseif (?wins iswm $1 && $left($1,1) isin @!.) { set -u2 %_snick %nick smsg %unochannel $allstats(wins,$iif($2,$2,%nick)) } elseif (?bestpoints iswm $1 && $left($1,1) isin @!.) { smsg %unochannel UNO highest points: $bytes(%unobestpoints,b) } elseif (?besttime iswm $1 && $left($1,1) isin @!.) { smsg %unochannel UNO best time: $duration(%unobesttime) } elseif (?worsttime iswm $1 && $left($1,1) isin @!.) { smsg %unochannel UNO worst time: $duration(%unoworsttime) } elseif (?unotop10 iswm $1 && $left($1,1) isin @!.) { var %az = $qt($scriptdiruno/unoscores.txt) if (!$read(%az,n,1)) { .timeruno1 -o 1 1 smsg $unsafe( %unochannel ) [UNO Total Top10] $chr(9679) No scores! | goto month } 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 } .timeruno1 -o 1 2 smsg $unsafe( %unochannel ) [UNO Total Top10] $chr(9679) $gettok(%total,1--1,9679) :month .timeruno2 -o 1 3 smsg $unsafe( %unochannel ) ================================== var %az = $qt($+($scriptdiruno/unoscores,.,$gettok($adate,1,47),.,$gettok($adate,3,47),.txt)) if (!$read(%az,n,1)) { .timeruno3 -o 1 4 smsg $unsafe( %unochannel ) [UNO Month Top10] $chr(9679) No scores! | goto today } 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 } .timeruno4 -o 1 5 smsg $unsafe( %unochannel ) [UNO Month Top10] $chr(9679) $gettok(%total,1--1,9679) :today .timeruno5 -o 1 6 smsg $unsafe( %unochannel ) ================================== var %az = $qt($+($scriptdiruno/unoscores,.,$gettok($adate,1,47),.,$gettok($adate,2,47),.,$gettok($adate,3,47),.txt)) if (!$read(%az,n,1)) { .timeruno6 -o 1 7 smsg $unsafe( %unochannel ) [UNO Today Top10] $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 } .timeruno7 -o 1 8 smsg $unsafe( %unochannel ) [UNO Today Top10] $chr(9679) $gettok(%total,1--1,9679) } elseif (?unotop10wins iswm $1 && $left($1,1) isin @!.) { var %az = $qt($scriptdiruno/unowins.txt) if (!$read(%az,n,1)) { .timeruno1 -o 1 1 smsg $unsafe( %unochannel ) [UNO Total Top10 Wins] $chr(9679) No wins! | goto month2 } 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 } .timeruno2 -o 1 2 smsg $unsafe( %unochannel ) [UNO Total Top10 Wins] $chr(9679) $gettok(%total,1--1,9679) :month2 .timeruno3 -o 1 3 smsg $unsafe( %unochannel ) ================================== var %az = $qt($+($scriptdiruno/unowins,.,$gettok($adate,1,47),.,$gettok($adate,3,47),.txt)) if (!$read(%az,n,1)) { .timeruno4 -o 1 4 smsg $unsafe( %unochannel ) [UNO Month Top10 Wins] $chr(9679) No wins! | goto today2 } 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 } .timeruno5 -o 1 5 smsg $unsafe( %unochannel ) [UNO Month Top10 Wins] $chr(9679) $gettok(%total,1--1,9679) :today2 .timeruno6 -o 1 6 smsg $unsafe( %unochannel ) ================================== var %az = $qt($+($scriptdiruno/unowins,.,$gettok($adate,1,47),.,$gettok($adate,2,47),.,$gettok($adate,3,47),.txt)) if (!$read(%az,n,1)) { .timeruno7 -o 1 7 smsg $unsafe( %unochannel ) [UNO Today Top10 Wins] $chr(9679) No wins! | 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 } .timeruno8 -o 1 8 smsg $unsafe( %unochannel ) [UNO Today Top10 Wins] $chr(9679) $gettok(%total,1--1,9679) } elseif (?remove iswm $1 && $left($1,1) isin @!.) { if ($ulist($address(%nick,5),admin,1) && $2) { if ($istok(%uno.players,$2,32)) { smsg %unochannel $2 has left the UNO game! %uno.players = $remtok(%uno.players,$2,1,32) unset $eval($+(%,$2,.hand),1) if ($numtok(%uno.players,32) <= 1) { cleanuphand smsg %unochannel Not enough players to play UNO! smsg %unochannel [UNO] $chr(9679) UNO is now Off! return } else { if (%uno.turn == $2) { skip } playnext } } else { smsg %unochannel No such UNO player playing! | return } } elseif ($istok(%uno.players,%nick,32) && $2) { smsg %unochannel Only UNO Admins can remove players from game! } elseif ($istok(%uno.players,%nick,32) && !$2) { smsg %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 smsg %unochannel Not enough players to play UNO! smsg %unochannel [UNO] $chr(9679) UNO is now Off! return } else { if (%uno.turn == %nick) { skip } playnext } } } elseif (?unorules iswm $1 && $left($1,1) isin @!.) { .notice %nick UNO Rules: https://www.unorules.com/ } elseif (?version iswm $1 && $left($1,1) isin @!.) { describe %unochannel is using: UNO $sversion - by $sauthor $syear } elseif (?unocmds iswm $1 && $left($1,1) isin @!.) { if (%_unoflood) { return } set -u10 %_unoflood flood if ($istok(%unoadmins,%nick,32)) { .timercmds1 -o 1 1 .notice %nick UNO Admin Commands: !botplays !botpoints !botnotice !botcolor !botmid !skip !addadmin !deladmin } .timercmds2 -o 1 2 .notice %nick UNO Commands: !uno !stop !remove !version !unorules !unocmds !bestpoints !besttime !last .timercmds3 -o 1 3 .notice %nick UNO Stats: !unotop10 !unotop10wins !points !wins .timercmds4 -o 1 4 .notice %nick UNO Card Commands: jo=join pl=play dr=draw pa=pass .timercmds5 -o 1 5 .notice %nick UNO Chan Commands: ca=cards ct=count tu=turn or=order cd=card ti=time .timercmds6 -o 1 6 .notice %nick UNO play wild: pl w <color> - or: pl wd4 <color> .timercmds7 -o 1 7 .notice %nick UNO play the bot: !unobot } elseif (?botplays iswm $1 && $left($1,1) isin @!.) { if (!$ulist($address(%nick,5),admin,1)) { smsg %unochannel Only admins can change that! } else { if ($2 == yes) { %unobot = yes } elseif ($2 == no) { %unobot = no } else { smsg %unochannel [UNO] $chr(9679) Invalid bot plays status! (available: yes/no) | return } smsg %unochannel [UNO] $chr(9679) Bot plays is now: %unobot } } elseif (?botpoints iswm $1 && $left($1,1) isin @!.) { if (!$ulist($address(%nick,5),admin,1)) { smsg %unochannel Only admins can change that! } else { if ($2 == yes) { %unopoints = yes } elseif ($2 == no) { %unopoints = no } else { smsg %unochannel [UNO] $chr(9679) Invalid bot points status! (available: yes/no) | return } smsg %unochannel [UNO] $chr(9679) Bot points are now: %unopoints } } elseif (?botnotice iswm $1 && $left($1,1) isin @!.) { if (!$ulist($address(%nick,5),admin,1)) { smsg %unochannel Only admins can change that! } else { if ($2 == yes) { %unojoin = yes } elseif ($2 == no) { %unojoin = no } else { smsg %unochannel [UNO] $chr(9679) Invalid bot auto join notice status! (available: yes/no) | return } smsg %unochannel [UNO] $chr(9679) Bot auto join notice is now: %unojoin } } elseif (?botcolor iswm $1 && $left($1,1) isin @!.) { if (!$ulist($address(%nick,5),admin,1)) { smsg %unochannel Only admins can change that! } else { if ($2 == $null) { smsg %unochannel [UNO] $chr(9679) No color specified! (00-99) } else { %unocolor = $2 | smsg %unochannel [UNO] $chr(9679) Color is now: %unocolor } } } elseif (?botmid iswm $1 && $left($1,1) isin @!.) { if (!$ulist($address(%nick,5),admin,1)) { smsg %unochannel Only admins can change that! } else { if ($2 == yes) { %unomid = yes } elseif ($2 == no) { %unomid = no } else { smsg %unochannel [UNO] $chr(9679) Invalid bot mid game status! (available: yes/no) | return } smsg %unochannel [UNO] $chr(9679) Bot mid game status is now: %unomid } } elseif (tu == $1) { if (%uno == on) { smsg %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 } smsg %unochannel Order: $replace(%uno.direction,left,$+([,$chr(11164),]),right,$+([,$chr(11166),])) $nohi(%all) } } elseif (jo == $1) { if ($numtok(%uno.players,32) >= 10) { smsg %unochannel UNO Maximum of 10 players playing! Please wait untill the next game to join. } elseif ($istok(%uno.players,%nick,32)) { smsg %unochannel You have already joined! } elseif (%unomid != yes && %uno == on) { smsg %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 smsg %unochannel $nohi(%nick) has joined UNO! if (%uno == on) { .timerunonotice $+ %nick -o 1 1 .notice %nick Hand: $colorize2($sorthand($eval($+(%,%nick,.hand),3))) } } else { smsg %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 == on) { .notice %nick Playing on: $colorize(%uno.topcard) } } elseif (ti == $1) { if (%uno == on && %uno.time) { smsg %unochannel Uno has been playing for: $duration($calc($ctime - %uno.time)) } } elseif (ct == $1) { if (%uno == on) { 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 -om 1 500 smsg $unsafe( %unochannel ) $nohi($gettok(%to,1--1,9679)) } } } elseif (dr == $1) { if (%uno == off) { return } elseif (%uno.turn != %nick) { smsg %unochannel Not your turn! } elseif ($eval($+(%,last.,%uno.turn),3)) { smsg %unochannel You already drew! } else { var %r = $drawcard set $eval($+(%,%uno.turn,.hand),1) $eval($+(%,%uno.turn,.hand),3) %r smsg %unochannel $nohi(%uno.turn) draws! .timerdraw $+ %uno.turn -o 1 1 .notice %uno.turn You drew: $colorize2(%r) 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) { smsg %unochannel Not your turn! } elseif (!$eval($+(%,last.,%uno.turn),3)) { smsg %unochannel You have not drawn yet! } else { smsg %unochannel $nohi(%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) smsg %unochannel it is now $+($chr(2),%uno.turn,$chr(2)) $+ 's turn! Playing on: $colorize(%uno.topcard) if (%uno.turn != $me) { .timerunonotice $+ %uno.turn -o 1 1 .notice %uno.turn Hand: $colorize2($sorthand($eval($+(%,%uno.turn,.hand),3))) } else { .timerunobotplay -o 1 3 botplay } .timerunonext -o 1 60 nextplayer } } elseif (pl == $1) { if (%uno == off) { return } elseif (!$2) { smsg %unochannel No card specified! } elseif (%uno.turn != %nick) { smsg %unochannel Not your turn! } else { if ($eval($+(%,%nick,_play),3)) { var %secs = $var($+(%,%nick,_play)).secs | smsg %unochannel Please wait %secs $iif(%secs == 1,second,seconds) before playing! | return } set -u3 $+(%,%nick,_play) $ctime var %d = $eval($+(%,draw.,%uno.turn),3) if (%d && %d != $2) { smsg %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 && $left($canplay(%uno.turn,%uno.topcard),1) != w) { smsg %unochannel You must play the cards you can play before playing a wild draw 4! return } if (!$3) { smsg %unochannel No color selected! | return } elseif (!$istok(red blue green yellow,$3,32) && !$istok(r b g y,$3,32)) { smsg %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) { smsg %unochannel Cannot play this card! return } } } elseif ($mid($2,2) == d4 && $mid(%a,2) == 4 && $left(%a,1) != $left($2,1)) || ($mid($2,2) == 4 && $mid(%a,2) == d4 && $left(%a,1) != $left($2,1)) { if (wd4 != $2 && w != $2) { smsg %unochannel Cannot play this card! return } } elseif ($mid($2,2) == d2 && $mid(%a,2) == 2 && $left(%a,1) != $left($2,1)) || ($mid($2,2) == 2 && $mid(%a,2) == d2 && $left(%a,1) != $left($2,1)) { if (wd4 != $2 && w != $2) { smsg %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) { smsg %unochannel Cannot play this card! return } } } elseif (%x !iswm $2 && %y !iswm $2) { if (wd4 != $2 && w != $2) { smsg %unochannel Cannot play this card! return } } ;========================= var %hand = $eval($+(%,%uno.turn,.hand),3) 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 ;========================= unset $eval($+(%,last.,%uno.turn),1) unset $eval($+(%,draw.,%uno.turn),1) ;Play Message smsg %unochannel $nohi(%uno.turn) has played: $colorize($2) ;UNO! if ($numtok($eval($+(%,%uno.turn,.hand),3),32) == 1) { smsg %unochannel $+($chr(2),$nohi(%uno.turn) declares UNO!,$chr(2)) } ;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 smsg %unochannel $nohi(%uno.turn) has played all their cards! smsg %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 smsg $unsafe( %unochannel ) $nohi(%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 } if (%points >= %unobestpoints || %unobestpoints == $null) { %unobestpoints = %points } .timer -o 1 %c smsg $unsafe( %unochannel ) Total UNO Points this round: $bytes(%points,b) $+($chr(40),$bytes(%unobestpoints,b) best,$chr(41)) var %p = $gettok($read($qt($scriptdiruno/unoscores.txt),wn,* %nick),1,32) if (%p == $null) { %p = 0 } inc %p %points unostats %p %nick var %n = $readn var %file = $qt($+($scriptdiruno/unoscores,.,$gettok($adate,1,47),.,$gettok($adate,3,47),.txt)) var %r = $gettok($read(%file,wn,* %nick),1,32) if (%r == $null) { %r = 0 } inc %r %points unomonthstats %r %nick var %m = $readn var %file = $qt($+($scriptdiruno/unoscores,.,$gettok($adate,1,47),.,$gettok($adate,2,47),.,$gettok($adate,3,47),.txt)) var %s = $gettok($read(%file,wn,* %nick),1,32) if (%s == $null) { %s = 0 } inc %s %points unotodaystats %s %nick var %o = $readn var %games var %file = $qt($+($scriptdiruno/unowins.txt)) var %q = $gettok($read(%file,wn,* %nick),1,32) if (%q == $null) { %q = 0 } inc %q 1 unowinstats %q %nick var %l = $readn %games = $nohi(%nick) has won: $bytes(%q,b) $iif(%q == 1,game!,games!) $iif(%l != 0,$+($chr(40),$ord(%l),$chr(41))) var %file = $qt($+($scriptdiruno/unowins,.,$gettok($adate,1,47),.,$gettok($adate,3,47),.txt)) var %q = $gettok($read(%file,wn,* %nick),1,32) if (%q == $null) { %q = 0 } inc %q 1 unomonthwins %q %nick var %l = $readn %games = %games $chr(9679) Monthly: $bytes(%q,b) $iif(%l != 0,$+($chr(40),$ord(%l),$chr(41))) var %file = $qt($+($scriptdiruno/unowins,.,$gettok($adate,1,47),.,$gettok($adate,2,47),.,$gettok($adate,3,47),.txt)) var %q = $gettok($read(%file,wn,* %nick),1,32) if (%q == $null) { %q = 0 } inc %q 1 unotodaywins %q %nick var %l = $readn %games = %games $chr(9679) Today: $bytes(%q,b) $iif(%l != 0,$+($chr(40),$ord(%l),$chr(41))) ;=================================== if (%uno.time) { if ($calc($ctime - %uno.time) <= %unobesttime || !%unobesttime) { %unobesttime = $calc($ctime - %uno.time) } if ($calc($ctime - %uno.time) >= %unoworsttime || !%unoworsttime) { %unoworsttime = $calc($ctime - %uno.time) } ;============== .timer -o 1 %c smsg $unsafe( %unochannel ) UNO was played for: $duration($calc($ctime - %uno.time)) $+($chr(40),$duration(%unobesttime) best,$chr(41)) } .timer -o 1 %c smsg $unsafe( %unochannel ) %games .timer -o 1 %c smsg $unsafe( %unochannel ) $nohi(%nick) now has: $bytes(%p,b) total points! $iif(%n != 0,$+($chr(40),$ord(%n),$chr(41))) $chr(9679) Monthly: $bytes(%r,b) $iif(%m != 0,$+($chr(40),$ord(%m),$chr(41))) $chr(9679) Today: $bytes(%s,b) $iif(%o != 0,$+($chr(40),$ord(%o),$chr(41))) cleanuphand return } ; CARD LISTINGS if (*r iswm $2) { %uno.direction = $iif(%uno.direction == left,right,left) if ($numtok(%uno.players,32) == 2) { %uno.turn = %nick } else { skip } smsg %unochannel Game direction reversed to: $nohi(%uno.turn) $iif($numtok(%uno.players,32) > 2, $replace(%uno.direction,left,$+([,$chr(11164),]),right,$+([,$chr(11166),]))) goto uno } elseif (*s iswm $2) { skip smsg %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 smsg %unochannel $nohi(%uno.turn) was skipped and dealt 4 cards... } elseif (*d2 iswm $2) { skip set $eval($+(%,%uno.turn,.hand),1) $eval($+(%,%uno.turn,.hand),3) $drawcard $drawcard smsg %unochannel $nohi(%uno.turn) was skipped and dealt 2 cards... } skip :uno %uno.topcard = $2 %uno.top = $colorize(%uno.topcard) unset $eval($+(%,last.,%uno.turn),1) unset $eval($+(%,draw.,%uno.turn),1) playnext } else { smsg %unochannel You don't have that card! } } } } ctcp *:VERSION:?:{ .ctcpreply $nick VERSION UNO $sversion - by $sauthor $syear - https://mircscripts.net/jbdpI } alias -l smsg { if (%unocolor != $null && c !isincs $chan($1).mode) { msg $1 $+($chr(3),%unocolor,$2-,$chr(3)) } else { msg $1- } } alias -l nohi { return $regsubex(_nohilite,$1-,/\S\S\K(?=\S)/gu,$chr(8205)) } ; by Raccoon alias -l botplay { if (%uno == off || !%uno.players) { return } elseif ($bestplay($me,%uno.topcard) && %uno.turn == $me) { var %ca = $bestplay($me,%uno.topcard), %col, %r, %s, %rt if (%ca == w || %ca == wd4) { %col = $mostcolors } msg %unochannel pl %ca %col if (%col == red) { %r = 04 | %s = 00 } if (%col == blue) { %r = 12 | %s = 00 } if (%col == green) { %r = 03 | %s = 00 } if (%col == yellow) { %r = 08 | %s = 01 } if (%ca == w || %ca == wd4) { %rt = $upper($+($chr(3),%s,$chr(44),%r,[,%ca,],$chr(3))) smsg %unochannel $nohi($me) has played: %rt %uno.wildcolor = $left(%col,1) } else { smsg %unochannel $nohi($me) has played: $colorize(%ca) } %uno.topcard = %ca %uno.top = $colorize(%uno.topcard) ;========================= var %hand = $eval($+(%,$me,.hand),3) var %a = $remtok(%hand,%ca,1,32) if (%a) { set $eval($+(%,$me,.hand),1) %a } else { unset $eval($+(%,$me,.hand),1) } %uno.discard = %uno.discard %ca ;========================= unset $eval($+(%,last.,$me),1) unset $eval($+(%,draw.,$me),1) if ($numtok($eval($+(%,$me,.hand),3),32) == 1) { smsg %unochannel $+($chr(2),$nohi($me) declares UNO!,$chr(2)) } ;END OF HAND! elseif (!$eval($+(%,$me,.hand),3)) { if (%ca == wd4) { skip set $eval($+(%,%uno.turn,.hand),1) $eval($+(%,%uno.turn,.hand),3) $drawcard $drawcard $drawcard $drawcard msg %unochannel $gettok(Put this in your pipe and smoke it %uno.turn $+ !.Eat this sucka!.HAHA!.Booya!.Boom mofo!,$r(1,5),46) } elseif (*d2 iswm %ca) { skip set $eval($+(%,%uno.turn,.hand),1) $eval($+(%,%uno.turn,.hand),3) $drawcard $drawcard } %uno.turn = $me .timeruno* off smsg %unochannel $nohi($me) has played all their cards! smsg %unochannel [UNO] Standings: var %a = 1, %b, %c = 0, %points = 0, %d, %hand while ($gettok(%uno.players,%a,32)) { %b = $v1 if (%b != $me) { inc %c .timer -o 1 %c smsg $unsafe( %unochannel ) $nohi(%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 } if (%points >= %unobestpoints || !%unobestpoints == $null) { %unobestpoints = %points } .timer -o 1 %c smsg $unsafe( %unochannel ) Total UNO Points this round: $bytes(%points,b) $+($chr(40),$bytes(%unobestpoints,b) best,$chr(41)) var %games if (%unopoints == yes) { var %p = $gettok($read($qt($scriptdiruno/unoscores.txt),wn,* $me),1,32) if (%p == $null) { %p = 0 } inc %p %points unostats %p $me var %n = $readn var %file = $qt($+($scriptdiruno/unoscores,.,$gettok($adate,1,47),.,$gettok($adate,3,47),.txt)) var %r = $gettok($read(%file,wn,* $me),1,32) if (%r == $null) { %r = 0 } inc %r %points unomonthstats %r $me var %m = $readn var %file = $qt($+($scriptdiruno/unoscores,.,$gettok($adate,1,47),.,$gettok($adate,2,47),.,$gettok($adate,3,47),.txt)) var %s = $gettok($read(%file,wn,* $me),1,32) if (%s == $null) { %s = 0 } inc %s %points unotodaystats %s $me var %o = $readn ; Most Wins (today/monthly) var %file = $qt($+($scriptdiruno/unowins.txt)) var %q = $gettok($read(%file,wn,* $me),1,32) if (%q == $null) { %q = 0 } inc %q 1 unowinstats %q $me var %l = $readn %games = $nohi($me) has won: $bytes(%q,b) $iif(%q == 1,game!,games!) $iif(%l != 0,$+($chr(40),$ord(%l),$chr(41))) var %file = $qt($+($scriptdiruno/unowins,.,$gettok($adate,1,47),.,$gettok($adate,3,47),.txt)) var %q = $gettok($read(%file,wn,* $me),1,32) if (%q == $null) { %q = 0 } inc %q 1 unomonthwins %q $me var %l = $readn %games = %games $chr(9679) Monthly: $bytes(%q,b) $iif(%l != 0,$+($chr(40),$ord(%l),$chr(41))) var %file = $qt($+($scriptdiruno/unowins,.,$gettok($adate,1,47),.,$gettok($adate,2,47),.,$gettok($adate,3,47),.txt)) var %q = $gettok($read(%file,wn,* $me),1,32) if (%q == $null) { %q = 0 } inc %q 1 unotodaywins %q $me var %l = $readn %games = %games $chr(9679) Today: $bytes(%q,b) $iif(%l != 0,$+($chr(40),$ord(%l),$chr(41))) } ;================================= if (%uno.time) { if ($calc($ctime - %uno.time) <= %unobesttime || !%unobesttime) { %unobesttime = $calc($ctime - %uno.time) } if ($calc($ctime - %uno.time) >= %unoworsttime || !%unoworsttime) { %unoworsttime = $calc($ctime - %uno.time) } ;============== .timer -o 1 %c smsg $unsafe( %unochannel ) UNO was played for: $duration($calc($ctime - %uno.time)) $+($chr(40),$duration(%unobesttime) best,$chr(41)) } if (%unopoints == yes) { if (%games) { .timer -o 1 %c smsg $unsafe( %unochannel ) %games } .timer -o 1 %c smsg $unsafe( %unochannel ) $nohi($me) now has: $bytes(%p,b) total points! $iif(%n != 0,$+($chr(40),$ord(%n),$chr(41))) $chr(9679) Monthly: $bytes(%r,b) $iif(%m != 0,$+($chr(40),$ord(%m),$chr(41))) $chr(9679) Today: $bytes(%s,b) $iif(%o != 0,$+($chr(40),$ord(%o),$chr(41))) } cleanuphand return } ; CARD LISTINGS if (*r iswm %ca) { %uno.direction = $iif(%uno.direction == left,right,left) if ($numtok(%uno.players,32) == 2) { %uno.turn = $me } else { skip } smsg %unochannel Game direction reversed to: $nohi(%uno.turn) $iif($numtok(%uno.players,32) > 2, $replace(%uno.direction,left,$+([,$chr(11164),]),right,$+([,$chr(11166),]))) goto uno2 } elseif (*s iswm %ca) { skip smsg %unochannel $nohi(%uno.turn) was skipped... } elseif (%ca == wd4) { skip set $eval($+(%,%uno.turn,.hand),1) $eval($+(%,%uno.turn,.hand),3) $drawcard $drawcard $drawcard $drawcard msg %unochannel $gettok(Put this in your pipe and smoke it %uno.turn $+ !.Eat this sucka!.HAHA!.Booya!.Boom mofo!,$r(1,5),46) smsg %unochannel $nohi(%uno.turn) was skipped and dealt 4 cards... } elseif (*d2 iswm %ca) { skip set $eval($+(%,%uno.turn,.hand),1) $eval($+(%,%uno.turn,.hand),3) $drawcard $drawcard smsg %unochannel $nohi(%uno.turn) was skipped and dealt 2 cards... } skip :uno2 unset $eval($+(%,last.,$me),1) unset $eval($+(%,draw.,$me),1) playnext } elseif (!$bestplay($me,%uno.topcard) && %uno.turn == $me) { msg %unochannel dr var %r = $drawcard set $eval($+(%,$me,.hand),1) $eval($+(%,$me,.hand),3) %r smsg %unochannel $nohi($me) draws! if ($bestplay($me,%uno.topcard)) { var %u = $v1, %ca = $v1 if (%ca == wd4 || %ca == w) { msg %unochannel pl %ca $mostcolors | %uno.wildcolor = $left($mostcolors,1) } else { msg %unochannel pl %ca } smsg %unochannel $nohi($me) has played: $colorize(%ca) ; CARD LISTINGS if (*r iswm %ca) { %uno.direction = $iif(%uno.direction == left,right,left) if ($numtok(%uno.players,32) == 2) { %uno.turn = $me } else { skip } smsg %unochannel Game direction reversed to: $nohi(%uno.turn) $iif($numtok(%uno.players,32) > 2, $replace(%uno.direction,left,$+([,$chr(11164),]),right,$+([,$chr(11166),]))) goto uno3 } elseif (*s iswm %ca) { skip smsg %unochannel $nohi(%uno.turn) was skipped... } elseif (%ca == wd4) { skip set $eval($+(%,%uno.turn,.hand),1) $eval($+(%,%uno.turn,.hand),3) $drawcard $drawcard $drawcard $drawcard smsg %unochannel $nohi(%uno.turn) was skipped and dealt 4 cards... } elseif (*d2 iswm %ca) { skip set $eval($+(%,%uno.turn,.hand),1) $eval($+(%,%uno.turn,.hand),3) $drawcard $drawcard smsg %unochannel $nohi(%uno.turn) was skipped and dealt 2 cards... } skip :uno3 %uno.topcard = %ca ;========================= var %hand = $eval($+(%,$me,.hand),3) var %a = $remtok(%hand,%ca,1,32) if (%a) { set $eval($+(%,$me,.hand),1) %a } else { unset $eval($+(%,$me,.hand),1) } %uno.discard = %uno.discard %ca ;========================= if ($numtok($eval($+(%,$me,.hand),3),32) == 1) { smsg %unochannel $+($chr(2),$nohi($me) declares UNO!,$chr(2)) } playnext } else { .timerunobotpass -o 1 3 botpass } } } alias -l botpass { msg %unochannel pa smsg %unochannel $nohi($me) passes! ;Playing on: $colorize(%uno.topcard) unset $eval($+(%,last.,$me),1) unset $eval($+(%,draw.,$me),1) skip unset $eval($+(%,last.,%uno.turn),1) unset $eval($+(%,draw.,%uno.turn),1) playnext } alias -l mostcolors { var %a = 1, %b, %c = $eval($+(%,$me,.hand),3), %d, %red = 0, %blue = 0, %green = 0, %yellow = 0 %red = $wildtok(%c,r*,0,32) %blue = $wildtok(%c,b*,0,32) %green = $wildtok(%c,g*,0,32) %yellow = $wildtok(%c,y*,0,32) var %a = 1, %b, %c = %red %blue %green %yellow, %to = 0, %card while ($gettok(%c,%a,32) != $null) { %b = $v1 if (%b >= %to) { %to = %b | %card = $replace(%a,1,red,2,blue,3,green,4,yellow) } inc %a } if (%card) { return %card } } alias -l canplay { ;$canplay(person,card_on_top) if (!$2 || %uno == off) { return } var %a = 1, %b, %c = $eval($+(%,$1,.hand),3), %d, %e, %canplay while ($gettok(%c,%a,32) != $null) { %b = $v1 var %d = $left(%b,1) var %e = $mid(%b,2) if ($left(%b,1) == w) { %canplay = %b } if ($left($2,1) == w && %d == %uno.wildcolor) { return %b } if (%d == $left($2,1)) || (%e == $mid($2,2)) { return %b } inc %a } if (%canplay) { return $v1 } } alias -l bestplay { ;$bestplay(person,card_on_top) if (!$2 || %uno == off) { return } var %c = $sorttok($eval($+(%,$1,.hand),3),32,a), %set, %set2 if ($left($2,1) == w) { %set = $left(%uno.wildcolor,1) | %set2 = $mid($2,2) } else { %set = $left($2,1) | %set2 = $mid($2,2) } if ($wildtok(%c,%set $+ *,0,32)) { return $wildtok(%c,%set $+ *,$v1,32) } elseif ($wildtok(%c,? $+ %set2,0,32)) { return $wildtok(%c,? $+ %set2,$v1,32) } elseif ($wildtok(%c,w*,1,32)) { return $v1 } } alias -l unowinstats { ;/unowinstats <N> <nick> if ($istok(%nostats,$2,32)) { return } var %az = $qt($scriptdiruno/unowins.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 unotodaywins { ;/unotodaywins <N> <nick> if ($istok(%nostats,$2,32)) { return } var %az = $qt($+($scriptdiruno/unowins,.,$gettok($adate,1,47),.,$gettok($adate,2,47),.,$gettok($adate,3,47),.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 unomonthwins { ;/unomonthwins <N> <nick> if ($istok(%nostats,$2,32)) { return } var %az = $qt($+($scriptdiruno/unowins,.,$gettok($adate,1,47),.,$gettok($adate,3,47),.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 unostats { ;/unostats <N> <nick> if ($istok(%nostats,$2,32)) { return } var %az = $qt($scriptdiruno/unoscores.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 unomonthstats { ;/unomonthstats <N> <nick> if ($istok(%nostats,$2,32)) { return } var %az = $qt($+($scriptdiruno/unoscores,.,$gettok($adate,1,47),.,$gettok($adate,3,47),.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 unotodaystats { ;/unotodaystats <N> <nick> if ($istok(%nostats,$2,32)) { return } var %az = $qt($+($scriptdiruno/unoscores,.,$gettok($adate,1,47),.,$gettok($adate,2,47),.,$gettok($adate,3,47),.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 clearunostats { var %a = 1, %b, %c, %_totalfiles = 0 while ($findfile($qt($scriptdiruno),unoscores.??.??.????.txt, %a)) { %c = $v1 %b = $gettok(%c,2--2,46) if (%b != $gettok($replace($adate,/,.),1-3,46)) { inc %_totalfiles | .remove $qt(%c) | %a = 1 | continue } inc %a } var %a = 1, %b, %c, %file while ($findfile($qt($scriptdiruno),unoscores.??.????.txt, %a)) { %c = $v1 %b = $gettok(%c,2--2,46) %file = $gettok($replace($adate,/,.),1,46) $+ . $+ $gettok($replace($adate,/,.),3,46) if (%b != %file) { inc %_totalfiles | .remove $qt(%c) | %a = 1 | continue } inc %a } echo -tag * Done. %_totalfiles file(s) deleted! } alias -l allstats { var %games, %out, %found = 0, %filex if ($1 == wins) { %filex = unowins } else { %filex = unoscores } if ($2 == %_snick) { var %out = $iif($1 == wins,You have won:,You have:) } else { var %out = $nohi($2) $iif($1 == wins,has won:,has:) } var %file = $qt($+($scriptdiruno/,%filex,.txt)) var %q = $gettok($read(%file,wn,* $2),1,32) if (%q == $null) { %q = 0 | inc %found } var %l = $readn %games = %out $bytes(%q,b) $iif($1 == wins,$iif(%q == 1,game!,games!),total $iif(%q == 1,point!,points!)) $iif(%l != 0,$+($chr(40),$ord(%l),$chr(41))) var %file = $qt($+($scriptdiruno/,%filex,.,$gettok($adate,1,47),.,$gettok($adate,3,47),.txt)) var %q = $gettok($read(%file,wn,* $2),1,32) if (%q == $null) { %q = 0 | inc %found } var %l = $readn %games = %games $chr(9679) Monthly: $bytes(%q,b) $iif(%l != 0,$+($chr(40),$ord(%l),$chr(41))) var %file = $qt($+($scriptdiruno/,%filex,.,$gettok($adate,1,47),.,$gettok($adate,2,47),.,$gettok($adate,3,47),.txt)) var %q = $gettok($read(%file,wn,* $2),1,32) if (%q == $null) { %q = 0 | inc %found } var %l = $readn if (%found == 3) { return [UNO] $chr(9679) No $1 for $2 $+ ! } else { %games = %games $chr(9679) Today: $bytes(%q,b) $iif(%l != 0,$+($chr(40),$ord(%l),$chr(41))) } return [UNO] $chr(9679) %games } alias -l cleanupfiles { var %a = 1, %b, %c, %file while ($findfile($qt($scriptdiruno),*.*, %a)) { %c = $v1 if (%c) { .remove $qt(%c) | %a = 1 | continue } inc %a } .remove $qt($mircdiruno.mrc) .timer -o 1 1 .rmdir $+($scriptdiruno) }
Changelog:
0
0
Comments (2)