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.

Wrong args error

Old posts that have not been replied to for several years.
Locked
M
Massacre
Voice
Posts: 27
Joined: Wed Mar 19, 2003 4:17 pm

Wrong args error

Post by Massacre »

I'm currently making a small script to remember and repeat information about our next war to other clan members. My problem is I keep getting this error generated in my logs:

Tcl error [setwarinfo]: wrong # args: should be "set varName ?newValue?"

but I can't find the part of my proc that's the problem. Can anyone help plz? Below is the bind and proc:

Code: Select all

bind pub - !setwar setwarinfo

proc setwarinfo { nick uhost hand chan arg } {
	global ws_clan
	global ws_maps
	global ws_players
	global ws_time
	global ws_day
	global ws_extras

	if {!([string match -nocase $arg ""])} {

		set ws_info [split $arg]

		set count 0
		while {!([string match -nocase [lindex $ws_info $count] ""])} { 
			if {$count == 0} {
				set ws_players [lindex $ws_info  $count]
			} elseif {$count == 1} {
				set ws_day [lindex $ws_info $count]
			} elseif {$count == 2} {
				set ws_clan [lindex $ws_info $count]
			} elseif {$count == 3} {
				set ws_time [lindex $ws_info $count]
			} elseif {$count == 4} {
				set ws_maps [lindex $ws_info $count]
			} else {
				set ws_extras $ws_extras [lindex $ws_info $count]
			}
			set count $count + 1
		}

		if {$count < 5} {
			putquick "PRIVMSG $chan :!setwar usage is: !setwar <players> <day> <clan> <time> <maps> <extras (optional)>"
		} else {
			putquick "PRIVMSG $chan :War set: $ws_players war $ws_day vs $ws_clan @ $ws_time on $ws_maps \[{$ws_extras}\]: 12\[USAGE\] Use !av, !ma, and !na to set ur status."
		}
	} else {
		putquick "PRIVMSG $chan :!setwar usage is: !setwar <players> <day> <clan> <time> <maps> <extras (optional)>"
	}
}
I'd be very greatful for any help as I have tried many things including putting checkpoints throughout the proc but as non of them were called I'm assuming the error occurs when the tcl parser, if u like, does its pre-execution checks. (The proc did work before I put the while loop in).
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

See the line

Code: Select all

set ws_extras $ws_extras [lindex $ws_info $count]
This is sending 3 seperate arguments to the set command.

If you are looking to add the information using a space, the enclose it in quotes

Code: Select all

set ws_extras "$ws_extras [lindex $ws_info $count]"
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

also

Code: Select all

set count $count + 1 
this does the same thing... and tcl does not work as php... you have to do something like

Code: Select all

set count [expr $count + 1]
Elen sila lúmenn' omentielvo
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

Code: Select all

incr count
This is the simplest approach.
M
Massacre
Voice
Posts: 27
Joined: Wed Mar 19, 2003 4:17 pm

Post by Massacre »

aha, thank u v much. I only started learning TCL yesterday so I'm not yet familer with all the functions/procs and stuff :p
Locked