egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

about caps and normal

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
ultralord
Master


Joined: 06 Nov 2006
Posts: 255

PostPosted: Thu Dec 04, 2008 8:10 am    Post subject: about caps and normal Reply with quote

hello.. i make one script and i set some variables and then i save them on the txt ( variables is nicks when someone run some binds his nick is on txt) all is ok.. but when i run some procs to count info from txt how many times nicks is displayed the bot dont count the nick because the nick is typing with caps ..

example:

my nick : Ultralord , i press !lalala
bot adds my nick Ultralord on txt
if i use my nick like ULTRALORD (with caps) my bot when i press the bind to show me the count results doesnt count all info from my nick Ultralord and ULTRALORD etc.


thanks i need to fix that is very usefull , thanks again
Back to top
View user's profile Send private message
tomekk
Master


Joined: 28 Nov 2008
Posts: 255
Location: Oswiecim / Poland

PostPosted: Thu Dec 04, 2008 8:56 am    Post subject: Reply with quote

u mean that Ultralord and ULTRALORD are two diffrent nicks for bot?

try to:
Code:
[string tolower $string]

before count, after this all nicks will be with small letters

:>
Back to top
View user's profile Send private message Visit poster's website
ultralord
Master


Joined: 06 Nov 2006
Posts: 255

PostPosted: Fri Dec 05, 2008 6:47 am    Post subject: Reply with quote

thanks for reply.

cant counting both words like Ultralord and ULTRALORD like one result?
Back to top
View user's profile Send private message
tomekk
Master


Joined: 28 Nov 2008
Posts: 255
Location: Oswiecim / Poland

PostPosted: Fri Dec 05, 2008 7:22 am    Post subject: Reply with quote

ultralord wrote:
thanks for reply.

cant counting both words like Ultralord and ULTRALORD like one result?


without tricks like [string tolower] i think no, because it is like in Unix systems, BIG_CHAR != small_char then ULTRALORD != Ultralord

put somewhere [string tolower] or "toupper" etc and all will be fine Smile
Back to top
View user's profile Send private message Visit poster's website
ultralord
Master


Joined: 06 Nov 2006
Posts: 255

PostPosted: Fri Dec 05, 2008 10:07 am    Post subject: Reply with quote

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 ?


Code:
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
       }
}
}



he count how many times the nick is on txt file and he announce the result.. but i must have the nick with small letters because i cant setup
set nick [string tolower $nick] or something.. any opinion?


thnx
Back to top
View user's profile Send private message
tomekk
Master


Joined: 28 Nov 2008
Posts: 255
Location: Oswiecim / Poland

PostPosted: Fri Dec 05, 2008 10:31 am    Post subject: Reply with quote

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 ?


why u can't?
put after proc definition set nick [string tolower $nick] this will overwrite the nick var with small letters nick, or set nickname [string tolower $nickname] whatever, after this all nicks will be "small"

can u paste whole script and some manual how to use it? I want to try it Smile

[edit]

ok I checked this proc, I wrote to "g_stats" {nick Nick NICK} and after:
Quote:
g_mygames "nick" "" "" ""


Quote:
[tomekk@zonk]:/home# ./proc.tcl
NOTICE nick :^C14,1[^C7?^C0 You make (nick) : 1 gathers this month. Rank: 1. Status: Admin. ^C7?^C14]


I wrote tiny proc to lower all nicks in this list, and I put it here:
Code:
proc g_mygames {nickname hand idx args} {
  global g_plstats g_pickupchan g_stats

  #here
   g_stats_to_lower

   if { [matchattr $idx L] } {
     ....



after that i got:
Quote:
NOTICE nick :^C14,1[^C7?^C0 You make (nick) : 3 gathers this month. Rank: 1. Status: Admin. ^C7?^C14]


here is this proc code:
Code:
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
}


:>
Back to top
View user's profile Send private message Visit poster's website
ultralord
Master


Joined: 06 Nov 2006
Posts: 255

PostPosted: Fri Dec 05, 2008 12:26 pm    Post subject: Reply with quote

i put first the string [string tolower $nick] etc.. but nothing no lucky .. i try your proc etc but works if i have nick with small letters like ultralord if i have Ultralord doesnt work..

also i am sorry icant paste all the code..
Back to top
View user's profile Send private message
tomekk
Master


Joined: 28 Nov 2008
Posts: 255
Location: Oswiecim / Poland

PostPosted: Fri Dec 05, 2008 1:37 pm    Post subject: Reply with quote

damn, i wish to help u Smile

I just can't get what you mean with this Ultra, ultra .. I rly see no problem to lower nick letters, even if he use some trigger like !test what is the problem to lower the $nick from proc input?

like u wrote, set nick [string tolower $nick] and all input nicks will be with small letters, set low_nick [string tolower $nick] or smth,

I just wanted the source to check what is going on but no problem.


///
Quote:
[tomekk@zonk]:/home# ./proc.tcl Nick



i just added "set nickname [string tolower $nickname]"
Quote:
[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]


all input nicks are "small" and all nicks in list are "small" too :>
Back to top
View user's profile Send private message Visit poster's website
ultralord
Master


Joined: 06 Nov 2006
Posts: 255

PostPosted: Fri Dec 05, 2008 2:22 pm    Post subject: Reply with quote

look to explain you better..

i have nick Ultralord and i press !mygames then the bot counting the txt file how many times nick Ultralord is on txt and announce the result.. and when i have nick ULTRALORD and i press !mygames doesnt announce anything because all nicks on txt is Ultralord and not ULTRALORD.. then after your 1st helpful post i put set nick [string tolower $nick] before my procs and now on txt write only nicks with small letters good.. the next problem is. if i have nick Ultralord cant counting because i have Ultralord and not ultralord because "ultralord" is on txt with small letters .. thats the latest problem :/ but if we find the solution from another way.. like new proc and his work is to count how many times is his nick on txt file and he announce the result and counting small and big letters ..

thanks for your help at all
Back to top
View user's profile Send private message
tomekk
Master


Joined: 28 Nov 2008
Posts: 255
Location: Oswiecim / Poland

PostPosted: Fri Dec 05, 2008 3:22 pm    Post subject: Reply with quote

okey,

then what is the problem to [string tolower] all data from txt file? after that all will be the same
Back to top
View user's profile Send private message Visit poster's website
ultralord
Master


Joined: 06 Nov 2006
Posts: 255

PostPosted: Fri Dec 05, 2008 4:10 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
tomekk
Master


Joined: 28 Nov 2008
Posts: 255
Location: Oswiecim / Poland

PostPosted: Fri Dec 05, 2008 4:17 pm    Post subject: Reply with quote

ultralord 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


ehh its simple bug Razz

if u run this !mygames or smth with nick "Ultralord" then your nick in script will be "Ultralord" (its normal because u run it from Ultralord and $nick in proc will be the same, with case sensitivity), u just need to lower this nick at the beginning and all other nicks, from file, from other variables too, if all data sources are "small" then there is no chance that nick != nick Smile
Back to top
View user's profile Send private message Visit poster's website
ultralord
Master


Joined: 06 Nov 2006
Posts: 255

PostPosted: Fri Dec 05, 2008 5:46 pm    Post subject: Reply with quote

yes but i put set nick [string tolower $nick] in the brgging of proc to have small letters but i dont unterestand why doesnt work.. something on proc reads the nick and not the string of small letters


tnx
Back to top
View user's profile Send private message
tomekk
Master


Joined: 28 Nov 2008
Posts: 255
Location: Oswiecim / Poland

PostPosted: Fri Dec 05, 2008 5:56 pm    Post subject: Reply with quote

if u dont want to post the source here feel free to PM me with it, I can try to fix it, np for me Smile

HF Smile
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber