This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Switch command problem

Old posts that have not been replied to for several years.
Locked
S
SmokeyOne
Halfop
Posts: 69
Joined: Tue Jan 14, 2003 6:04 am

Switch command problem

Post by SmokeyOne »

I seem to be haveing trouble on this switch command, I'm not real good at them, so i thought maybe someone could point out my mistake.

This script is just setup to send a file on a trigger but this is the error form the bot
Tcl error [dbzxsf:!tcl]: wrong # args: should be "switch ?switches? string pattern body ... ?default body?"

now here's the code
#set commands
set dbzx_sf(!tcl) doc/tcl-commands.doc
#Routines
#This Sends helpful files
foreach buffer [array names dbzx_sf] {
set buffer2 [string tolower $buffer]
set dbzx_sf($buffer2) $dbzx_sf($buffer)
set buffer $buffer2
bind pubm - "% $buffer" dbzxsf:$buffer
proc dbzxsf:$buffer {nick uhost hand chan args} {
global dbzx_sf
switch -- [dccsend $dbzx_sf([set trigger [string tolower [lindex [lindex $args 0] 0]]]) $nick]
0 {putnot $nick ":Sending $trigger's info to you."}
1 {putnot $nick ":dcc table is full (too many connections)."}
2 {putnot $nick ":can't open a socket for the transfer."}
3 {putnot $nick ":file doesn't exsist."}
4 {putnot $nick ":$trigger's info was queued for last transfer."}
}
}

I'm uesing the tcl comamnds.doc file for testing i get an error saying the switch is [censored] up ( bascily ) but when i change it from Switch -- to Switch --- it sends the file, but i get this error
Tcl error [dbzxsf:!tcl]: bad option "---": must be -exact, -glob, -regexp, or --

any suggestions on where i messed up ?
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

Try issuing a dccsend, and storing the return value in a variable.

Use the variable to dot he switch on.
S
SmokeyOne
Halfop
Posts: 69
Joined: Tue Jan 14, 2003 6:04 am

Post by SmokeyOne »

I thank you for the suggestion, the code does work and I found out why.

at the end of the dccsend line i stupid forgot to add this {

/me shoots self in head for not seeing this


thanks =D
Locked