# RandNumGame by marky-b
# Set this line to your preferred trigger
set RandTrigger "!random"
##########
## code ##
##########
proc RandGame {nick host hand chan text} {
set userrand "$text"
set botrand [list 1 2 3 4 5 6 7 8 9]
if {$userrand > 9 } {
putserv "PRIVMSG $chan :Sorry $nick. Please choose a number between 1 and 9."
} else {
if {$userrand == [rand $botrand]} {
putserv "PRIVMSG $chan :Congratulations $nick, you've guessed the random number! Here's a cookie :)"
} else {
putserv "PRIVMSG $chan :Close, but that wasn't the random number, $nick."
}
}
}
bind pub -|- $RandTrigger RandGame
putlog "-RandGame script loaded"