that's one of the features of the channel voter script. it also reminds user who haven't voted yed and are allowed to vote. as i said, not bad, but only one vote at the same time and only the answers "yes" or "no"...dvV wrote:would be very cool to have it set up to only allow one vote per host
Code: Select all
proc any_vote {nick mask hand chan args} {
global botnick
if {$args == ""} {
puthelp "PRIVMSG $chan No params."
} else {
set time [lindex [split $args] 0]
set topic [lindex [split $args] 1]
set answers [lrange [split $args] 2 end]
puthelp "PRIVMSG $chan time: $time, topic: $topic, answers: $answers"
}
}
Code: Select all
proc test {a b {c ""} {d ""}} {
return $a
}
Code: Select all
proc test {a b c d} {
}
is the same as
proc test {args} {
set a [lindex $args 0]
set b [lindex $args 1]
set c [lindex $args 2]
set d [lindex $args 3]
}
so that the time, quoestion and answeres are seperate. Simply enclosing them in quotes, isn't enough for Tcl to split it correctly.newvote 10m "What is your favourate colour" "blue:red:orange"
that's my next problemIt is upto the programmer to go through the text, and split it up acordingly.
Code: Select all
proc vote {nick mask hand chan arg} {
global botnick
if {$arg == ""} {
puthelp "PRIVMSG $chan :No arguments."
return 0
} else {
set time [lindex $arg 0]
set topic [lindex $arg 1]
set answers [lindex $arg 2]
puthelp "PRIVMSG $chan :time: $time, topic: $topic, answers: $answers"
}
}
Code: Select all
set count "0"
for {set number "1"} {$number < [llength $answers]} {incr number} {
append $count " 0"
}
set $count [split $count]