Code: Select all
#
# Marky's Uno v0.97
# Copyright (C) 2004 Mark A. Day (techwhiz@earthlink.net)
#
# Uno(tm) is Copyright (C) 2001 Mattel, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# Default settings
set UnoAds 1
set UnoDebug 0
set UnoChan "#madlibs"
set UnoRobot $botnick
set UnoPointsName "Points"
set UnoStopAfter 3
set UnoBonus 1000
set UnoWildDrawTwos 0
set UnoCFGFile "scripts/uno.cfg"
set UnoScoreFile "scores/UnoScores"
set UnoMaxNickLen 9
set UnoMaxPlayers 10
set UnoOpFlags "o|o"
set UnoNTC "NOTICE"
set UnoVersion "0.98"
# Command binds
bind pub - !unocmds UnoCmds
bind pub - !remove UnoRemove
bind pub - !pause UnoPause
bind pub - !unowon UnoWon
bind pub - !unotop10 UnoTopTen
bind pub - !unotop3last UnoTopThreeLast
bind pub - !unostats UnoPlayStats
bind pub - !unorecords UnoRecords
bind pub - !unorow UnoCurrentRow
bind pub - !unoversion UnoVersion
bind pub - !uno UnoInit
bind pub - !stop UnoStop
# DCC commands
bind dcc - unohands dccunohands
bind dcc - unorehash dcc_unorehash
# Monthly score reset
bind time - "00 00 01 * *" UnoNewMonth
# Global variables
set UnoOn 0
set UnoMode 0
set UnoPaused 0
set UnoPlayers 0
set MasterDeck ""
set UnoDeck ""
set DiscardPile ""
set PlayCard ""
set RoundRobin ""
set ThisPlayer ""
set ThisPlayerIDX 0
set UnoStartTime [unixtime]
set IsColorChange 0
set ColorPicker ""
set IsDraw 0
set UnoIDX ""
set UnPlayedRounds 0
set UnoWinDefault 0
set UnoLastWinner ""
set UnoWinsInARow 0
# Scores, records and ads
set UnoLastMonthCards(0) "Nobody 0"
set UnoLastMonthCards(1) "Nobody 0"
set UnoLastMonthCards(2) "Nobody 0"
set UnoLastMonthGames(0) "Nobody 0"
set UnoLastMonthGames(1) "Nobody 0"
set UnoLastMonthGames(2) "Nobody 0"
set UnoFast "Nobody 600"
set UnoHigh "Nobody 0"
set UnoPlayed "Nobody 0"
set UnoRow "Nobody 0"
set UnoRecordHigh "Nobody 0"
set UnoRecordFast "Nobody 600"
set UnoRecordCard "Nobody 0"
set UnoRecordWins "Nobody 0"
set UnoRecordPlayed "Nobody 0"
set UnoRecordRow "Nobody 0"
set UnoAdNumber 0
# Card stats
set CardStats(played) 0
set CardStats(wilds) 0
set CardStats(draws) 0
set CardStats(skips) 0
# Timers
set UnoStartTimer ""
set UnoSkipTimer ""
set UnoCycleTimer ""
set UnoBotTimer ""
# Grace periods and timeouts
# AutoSkipPeriod can be raised but no lower than 2
set AutoSkipPeriod 4
set StartGracePeriod 20
set RobotRestartPeriod 1
set UnoCycleTime 30
# Nick colours
set UnoNickColors "06 13 03 07 12 10 04 11 09 08"
# Cards and logo
set UnoRedCard "\0030,04 Red "
set UnoGreenCard "\0030,03 Green "
set UnoBlueCard "\0030,12 Blue "
set UnoYellowCard "\0031,08 Yellow "
set UnoSkipCard "\002Skip\002 \003 "
set UnoReverseCard "\002Reverse\002 \003 "
set UnoDrawTwoCard "\002Draw Two\002 \003 "
set UnoWildCard "\0031,8 \002W\0030,3I \0030,4L\0030,12D\002 \003 "
set UnoWildDrawFourCard "\0031,8 \002W\0030,3I \0030,4L\0030,12D \0031,8D\0030,3r\0030,4a\0030,12w \0031,8F\0030,3o\0030,4u\0030,12r\002 \003 "
set UnoLogo "\002\0033U\00312N\00313O\00308!\002\003"
#
# Bind channel commands
#
proc UnoBindCmds {} {
bind pub - jo UnoJoin
bind pub - od UnoOrder
bind pub - ti UnoTime
bind pub - ca UnoShowCards
bind pub - pl UnoPlayCard
bind pub - cd UnoTopCard
bind pub - tu UnoTurn
bind pub - dr UnoDraw
bind pub - co UnoColorChange
bind pub - pa UnoPass
bind pub - ct UnoCardCount
bind pub - st UnoCardStats
bind chon - * unologin:dcc
bind chof - * unologout:dcc
bind filt - .quit* unologout:filt
}
#
# Unbind channel commands
#
proc UnoUnbindCmds {} {
catch {unbind pub - jo UnoJoin}
catch {unbind pub - od UnoOrder}
catch {unbind pub - ti UnoTime}
catch {unbind pub - ca UnoShowCards}
catch {unbind pub - pl UnoPlayCard}
catch {unbind pub - cd UnoTopCard}
catch {unbind pub - tu UnoTurn}
catch {unbind pub - dr UnoDraw}
catch {unbind pub - co UnoColorChange}
catch {unbind pub - pa UnoPass}
catch {unbind pub - ct UnoCardCount}
catch {unbind pub - st UnoCardStats}
catch {unbind chon - * unologin:dcc}
catch {unbind chof - * unologout:dcc}
catch {unbind filt - .quit* unologout:filt}
}
#
# Reset game variables
#
proc UnoReset {} {
global UnoOn UnoMode UnoPaused UnoPlayers RoundRobin UnoDeck ThisPlayer ThisPlayerIDX PlayCard
global DiscardPile IsColorChange ColorPicker IsDraw UnoIDX MasterDeck CardStats
global UnoStartTimer UnoSkipTimer UnoCycleTimer UnoWinDefault UnoRobot botnick
set UnoMode 0
set UnoPaused 0
set UnoPlayers 0
set MasterDeck ""
set UnoDeck ""
set DiscardPile ""
set RoundRobin ""
set ThisPlayer ""
set ThisPlayerIDX 0
set PlayCard ""
set IsColorChange 0
set ColorPicker ""
set IsDraw 0
set UnoIDX ""
set UnoAdNumber 0
set UnoWinDefault 0
set CardStats(played) 0
set CardStats(wilds) 0
set CardStats(draws) 0
set CardStats(skips) 0
set UnoStartTimer ""
set UnoSkipTimer ""
set UnoCycleTimer ""
set UnoRobot $botnick
return
}
#
# is this the uno channel?
#
proc uno_ischan {chan} {
global UnoChan
if {($chan == $UnoChan)} {return 1}
return 0
}
#
# Stop a game
#
proc UnoStop {nick uhost hand chan txt} {
global UnoOn UnoPaused UnPlayedRounds UnoStartTimer UnoSkipTimer UnoCycleTimer RoundRobin UnoDCCIDX
global UnoLastWinner UnoWinsInARow
if {(![uno_ischan $chan])||($UnoOn == 0)} {return}
catch {killutimer $UnoStartTimer}
catch {killtimer $UnoSkipTimer}
catch {killutimer $UnoCycleTimer}
# remove player dcc list
set pcount 0
while {[lindex $RoundRobin $pcount] != ""} {
set pnick [lindex $RoundRobin $pcount]
if [info exist UnoDCCIDX($pnick)] {unset UnoDCCIDX($pnick)}
respond
game not work in the channel.
Can anyone help me to fix it?