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.

any one know....

Old posts that have not been replied to for several years.
Locked
o
orbit

Post by orbit »


....how to resolve this ?

TCL error [searchfor]: wrong # args: should be "lindex list index"

code

bind pub -|- !search searchfor

proc searchfor {nick uhost hand chan args} {
foreach line [split [exec /home/diktatorn/bots/orbitmp3/search.sh [lindex $args 0] [lindex $args 1] [lindex $args 2] [lindex $args 3]
[lindex $args 4] [lindex $args 5] [lindex $args 6]] n] {
set temp ""
if {[string match "??/??/????" [lindex $line 0]]} { foreach word [lrange $line 1 end] { set temp "$temp $word" }
putserv "PRIVMSG $nick :0314[030315[lindex $line 0]030314]03
0316-03$temp"
} else {putserv "PRIVMSG $nick :0310$line03"}
}


end of code


//orbit
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

Firstly, there is a missing } in thecode.

It looks like a problem with using strings with lists commands.
foreach word [lrange $line 1 end] {
This is not needed, a simple
set temp [lrange $line 1 end]
will do exactly the same thing.

You use split to split each line of input from the exec, but you don't split the $line var into a list, so lindex can be used on it.

while changing the problem above, you could simply change the line
set temp ""
to
set line [split $line]
Note, you should not use args in your proc argument definitions. args has a special use in Tcl, arg, rest, test, to name a few are more suitible values.
Locked