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.

Tcl error

Old posts that have not been replied to for several years.
Locked
B
Black|Man
Voice
Posts: 21
Joined: Fri Oct 25, 2002 8:49 am
Location: Denmark

Tcl error

Post by Black|Man »

need some help to fix this problem

Tcl error [find]: list element in braces followed by "" instead of space

Code: Select all

bind pub -|- !find find


proc exec_players {} {
    return [exec ./qstat -sort g -default rwm -Ts server.qstat -Tp players.qstat -f qstatserverlist.lst -P]
}


proc find {nick host hand chan arg} {
    if {[llength $arg] < 1} then {
	putquick "NOTICE $nick : You might wanna put in a search word to limit the list a bit"
	return
    }
    putquick "NOTICE $nick :4Starting Search For 9 [lindex $arg 0]  4Please Patience"
    set stat [exec_players]
    set stat_arr [split $stat "\n"]
    set i 0
    set str $stat_arr
    set found 0
    #    set str [lsort $stat_arr]
    for {set i 0} {$i < [llength $str]} {incr i} {
	set j [expr $i + 1]
	# Loop through all the players and save them into a list
	while {[string range [lindex $str $j] 0 6] == "Player:"} {
	    set player [string trimleft [lindex $str $j] "Player:"]
	    set playername [lindex [split $player " "] 2]
	    set server [join [lindex [split [lindex $str $i] ""] 1] " "]
	    if {[string first [string tolower $arg] [string tolower $playername]] != -1} then {
		incr found
		putquick "NOTICE $nick :$playername is on $server "
	    }
	    incr j
	}
	# Make sure we don't check through the players again
	set i [expr $j - 1]
    }
    set info_str [get_number_of $found "player"]
    putquick "NOTICE $nick :$info_str"
    return 0
}
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

Seems the script plainly doesn;t care for strings and lists.

Code: Select all

bind pub -|- !find find 


proc exec_players {} { 
    return [exec ./qstat -sort g -default rwm -Ts server.qstat -Tp players.qstat -f qstatserverlist.lst -P] 
} 


proc find {nick host hand chan arg} { 
    if {[llength [split $arg]] < 1} then { 
   putquick "NOTICE $nick : You might wanna put in a search word to limit the list a bit" 
   return 
    } 
    putquick "NOTICE $nick :4Starting Search For 9 [lindex [split $arg] 0]  4Please Patience" 
    set stat [exec_players] 
    set stat_arr [split $stat "\n"] 
    set i 0 
    set str $stat_arr 
    set found 0 
    #    set str [lsort $stat_arr] 
    for {set i 0} {$i < [llength $str]} {incr i} { 
   set j [expr $i + 1] 
   # Loop through all the players and save them into a list 
   while {[string range [lindex $str $j] 0 6] == "Player:"} { 
       set player [string trimleft [lindex $str $j] "Player:"] 
       set playername [lindex [split $player " "] 2] 
       set server [join [lindex [split [lindex $str $i] ""] 1] " "] 
       if {[string first [string tolower $arg] [string tolower $playername]] != -1} then { 
      incr found 
      putquick "NOTICE $nick :$playername is on $server " 
       } 
       incr j 
   } 
   # Make sure we don't check through the players again 
   set i [expr $j - 1] 
    } 
    set info_str [get_number_of $found "player"] 
    putquick "NOTICE $nick :$info_str" 
    return 0 
}
This may work, but I didn't look properly.
B
Black|Man
Voice
Posts: 21
Joined: Fri Oct 25, 2002 8:49 am
Location: Denmark

Post by Black|Man »

hmmm the same problem

Tcl error [find]: list element in braces followed by "" instead of space

maybe that will help if i split serverlist on 3 part qstatserverlist.lst ?


ex

Code: Select all

proc exec_players {} { 
    return [exec ./qstat -sort g -default rwm -Ts server.qstat -Tp players.qstat -f 01qstatserverlist.lst/02qstatserverlist.lst/03qstatserverlist.lst -P] 
}
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

Somthign I notced while looking over it.

There is a second command called "get_number_of".

The error may be in there.

Allthough the error messages says it is in the find proc, this is because fo the way eggdrop reports the last Tcl command it executed (while in that command, Tcl will do the rest of the work).
Locked