All pastes #330690 Raw Edit

Someone

public text v1 · immutable
#330690 ·published 2007-01-28 04:26 UTC
rendered paste body
bind pub -|- !guess guess:proc

proc guess:proc {nick host hand chan text} {
set user_num [lindex $text 0]

set rand_nums {
"1"
"2"
"3"
"4"
"5"
"6"
"7"
"8"
"9"
}

switch -exact $user_num {
1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 {}
default {putserv "PRIVMSG $chan : Choose a num. between 1-9"; return}
}


set magic_num [lindex $rand_nums [rand [llength $rand_nums]]]

if {$magic_num == $user_num} {
putserv "PRIVMSG $chan :WOW! Good job you guessed the magic number"
} else {
putserv "PRIVMSG $chan :Awww... So close but no cookie. Please try again."
}
}