Use a global array to keep track of the state of each person, and another array to keep track of what they said so far.
Add in code to check nick changes, parts, quits, kicks, to keep the arrays updated.
You could also make it non-linear, so that they can answer in whatever order they want, as long as they start with !create and end with !done or something.
Code: Select all
bind pub !create - on_create
bind pub !name - on_name
proc on_create {nick uhost hand chan text} {
global state
set state($nick) 1
putserv "privmsg $chan :Okay, now type !name <blah> to set your name"
}
proc on_name {nick uhost hand chan text} {
global state answers
if {![info exists state($nick)]} {
putserv "privmsg $chan :You have to use !create first"
return 0
}
if {$state($nick) > 1} {
putserv "privmsg $chan :You already entered your name, fool"
return 0
}
putserv "privmsg $chan :Good job, now type !baa <noise> to set your favorite animal noise."
lappend answers($nick) $text
set state($nick) 2
}