Code: Select all
[string tolower $string]
without tricks like [string tolower] i think no, because it is like in Unix systems, BIG_CHAR != small_char then ULTRALORD != Ultralordultralord wrote:thanks for reply.
cant counting both words like Ultralord and ULTRALORD like one result?
Code: Select all
proc g_mygames {nickname hand idx args} {
global g_plstats g_pickupchan g_stats
if { [matchattr $idx L] } {
if {[llength $g_stats]==0} {
putserv "NOTICE $nickname :No Gather yet :)"
return 0
}
set stats $g_stats
set results [list ]
while {[llength $stats]!=0} {
set match [lindex $stats 0]
set counter 0
set temp [list ]
set temp [linsert $temp end $match]
while {[lsearch -exact $stats $match]>-1} {
incr counter
set pos [lsearch -exact $stats $match]
set stats [lreplace $stats $pos $pos]
}
set temp [linsert $temp end $counter]
set results [linsert $results end $temp]
}
set results [lsort -integer -decreasing -index 1 $results]
set counter 1
# putquick "NOTICE $nickname :1,0«1,15«1,14«0,1 Top 10 gather players. 1,14»1,15»1,0»"
foreach result $results {
if { [matchattr $idx G] } {
set admin0r 1
} else {
set admin0r 0
}
if {$nickname == [lindex $result 0]} {
if {$admin0r == 1} {
putquick "NOTICE $nickname :14,1\[7«0 You make ([lindex $result 0]) : [lindex $result 1] gathers this month. Rank: $counter. Status: Admin. 7»14]"
} else {
putquick "NOTICE $nickname :14,1\[7«0 You make ([lindex $result 0]) : [lindex $result 1] gathers this month. Rank: 4 $counter0,1. Status: 4Admin0,1. 7»14]"
}
}
incr counter
}
} else {
if {[llength $g_stats]==0} {
putserv "NOTICE $nickname :No Gather yet :)"
return 0
}
set stats $g_stats
set results [list ]
while {[llength $stats]!=0} {
set match [lindex $stats 0]
set counter 0
set temp [list ]
set temp [linsert $temp end $match]
while {[lsearch -exact $stats $match]>-1} {
incr counter
set pos [lsearch -exact $stats $match]
set stats [lreplace $stats $pos $pos]
}
set temp [linsert $temp end $counter]
set results [linsert $results end $temp]
}
set results [lsort -integer -decreasing -index 1 $results]
set counter 1
# putquick "NOTICE $nickname :1,0«1,15«1,14«0,1 Top 10 gather players. 1,14»1,15»1,0»"
foreach result $results {
if { [matchattr $idx G] } {
set admin0r 1
} else {
set admin0r 0
}
if {$nickname == [lindex $result 0]} {
if {$admin0r == 1} {
putquick "NOTICE $nickname :14,1\[7«0 You make ([lindex $result 0]) : [lindex $result 1] gathers this month. Rank: $counter. Status: Admin. 7»14]"
} else {
putquick "NOTICE $nickname :14,1\[7«0 You make ([lindex $result 0]) : [lindex $result 1] gathers this month. Rank: 4 $counter0,1. Status: 4Admin0,1. 7»14]"
}
}
incr counter
}
}
}
why u can't?ultralord wrote:ok i edited now and all nicks are on small letters the problem is some procs worked without $nick and i cant set it the string so how i can make that proc to work ?
g_mygames "nick" "" "" ""
I wrote tiny proc to lower all nicks in this list, and I put it here:[tomekk@zonk]:/home# ./proc.tcl
NOTICE nick :^C14,1[^C7?^C0 You make (nick) : 1 gathers this month. Rank: 1. Status: Admin. ^C7?^C14]
Code: Select all
proc g_mygames {nickname hand idx args} {
global g_plstats g_pickupchan g_stats
#here
g_stats_to_lower
if { [matchattr $idx L] } {
....
here is this proc code:NOTICE nick :^C14,1[^C7?^C0 You make (nick) : 3 gathers this month. Rank: 1. Status: Admin. ^C7?^C14]
Code: Select all
proc g_stats_to_lower { } {
global g_stats
set temp_low [list]
foreach big_stat $g_stats {
if {$big_stat != ""} {
set need_low_nick [string tolower $big_stat]
lappend temp_low $need_low_nick
}
}
set g_stats $temp_low
}
i just added "set nickname [string tolower $nickname]"[tomekk@zonk]:/home# ./proc.tcl Nick
all input nicks are "small" and all nicks in list are "small" too :>[tomekk@zonk]:/home# ./proc.tcl Nick
NOTICE nick :^C14,1[^C7?^C0 You make (nick) : 3 gathers this month. Rank: 1. Status: Admin. ^C7?^C14]
ehh its simple bugultralord wrote:i dotn underestand what you mean..i try before your solution and the problem is one.. all nicks on txt is with small letters and bot response the answer for counting if i had ultralord (with small letters) if i run proc for counting with Ultralord with one or more letters with caps doesnt response