proc qrequest {nick uhost hand chan args} {
global qqueue home
set commands [split $args " "]
set channel [lindex $commands 0]
set chantype [lindex $commands 1]
lappend qqueue $channel
lappend qqueue $nick
lappend qqueue $chantype
set qqlength [expr [llength $qqueue] / 3]
notice $nick "$nick, your request for $channel (Type: $chantype) has been queued. There are $qqlength items in queue."
}
but the response I get:
tuxX, your request for {#rbot (Type: private}) has been queued. There are 1 items in queue.
This is because fo the way you split it, and the variable name you used.
$args has a special function in Tcl, and is used to access unlimited length argument lists. Examples of this include the "list" command, where can keep on specifying items to add.
The $args vaiable is allready a list of the arguments passed, so you don't need to split it.
Change this to arg in the definition, and the same in the split.
Second, you dont need the " " in the split. Split uses " " by default.
proc qrequest {nick uhost hand chan arg} {
global qqueue home
set commands [split $arg]
lappend qqueue [lindex $commands 0]
lappend qqueue $nick
lappend qqueue [lindex $commands 1]
set qqlength [expr [llength $qqueue] / 3]
notice $nick "$nick, your request for $channel \(Type: $chantype\) has been queued. There are $qqlength items in queue."
}
Last edited by bz on Thu Apr 10, 2003 6:54 am, edited 1 time in total.