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 

problem in chanlist with nick char

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    egghelp.org community Forum Index -> Archive
View previous topic :: View next topic  
Author Message
Careto
Voice


Joined: 02 Mar 2004
Posts: 11

PostPosted: Tue Mar 02, 2004 1:56 pm    Post subject: problem in chanlist with nick char Reply with quote

I have one problem with chanlist:

Code:
bind join - "#canal *" topics
proc topics {nick uhost hand chan} {
if {[string equal -nocase $chan "$chan"]} {
set file [open pruebanick w]
set cuentame [chanlist $chan]
regsub -all "{" $cuentame "" cuentame
regsub -all "}" $cuentame "" cuentame
puts $file "$cuentame"
set op 0
set voice 0
set normal 0
putserv "notice $nick :Topic: [lrange [topic $chan] 0 end]"
putserv "notice $nick :Total de Usuarios: [llength [chanlist $chan]]"
putserv "notice $nick :Modos del canal: [lindex [getchanmode $chan] 0]"
foreach user [chanlist $chan] {
    if {[isop $user $chan]} {
      incr op
    } elseif {[isvoice $user $chan]} {
      incr voice
    } else { incr normal }
  }
putserv "notice $nick :Total de Op: $op - Total Voice: $voice - Total Normales: $normal"
}
close $file
}

bind part - "#canal *" partes
proc partes {nick uhost hand chan reason} {
if {$reason == ""} {
if {[string equal -nocase $chan "$chan"]} {
set file [open pruebanick w]
set cuentame [chanlist $chan]
regsub -all $nick $cuentame "" cuentame
set prueba [lsort -increasing -dictionary $cuentame]
puts $file "$prueba"
}
close $file
}
}


the problem is, in $file chanlist, if nick is [^__^] or |-XXX-|, when copying itself in the file it appears {[^__^]}, in the bind join this corrected with:
Code:

regsub -all "{" $cuentame "" cuentame
regsub -all "}" $cuentame "" cuentame

But in the bind part, not remove $nick with char "[] {} | |".
thanks
Back to top
View user's profile Send private message
strikelight
Owner


Joined: 07 Oct 2002
Posts: 708

PostPosted: Tue Mar 02, 2004 2:01 pm    Post subject: Reply with quote

There is no need to be using regsub..
Your problem is with trying to use lists as strings...

for example... you use "lrange" to return a LIST, which will escape/protect special character elements...
To convert to a string you must use the [join] command....

ie. Topic: [join [lrange yer-normal-stuff-here]]

And when writing your variable "prueba" and "cuentame" to file, they are lists,
if you want to write it as a string, you must again, use [join]...

ie. puts $file "[join $prueba]"
Back to top
View user's profile Send private message Visit poster's website
Careto
Voice


Joined: 02 Mar 2004
Posts: 11

PostPosted: Tue Mar 02, 2004 6:04 pm    Post subject: Reply with quote

Thanks strikelight

The list of nick appears to me all good, with nicks correct with
Code:
puts $file "[join $$prueba]"

But now not like doing, that in part it clears to nick that it leaves the channel, of the list and sees the others nicks.
IE. In Join: [^__^] atest axe
In part: (if list leaves the channel [^__^]): atest axe

Thanks.
Back to top
View user's profile Send private message
stdragon
Owner


Joined: 23 Sep 2001
Posts: 959

PostPosted: Tue Mar 02, 2004 6:28 pm    Post subject: Reply with quote

You can search the list with lsearch and remove the nick you want with lreplace, for part. For join, you can add the nick you want with lappend.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    egghelp.org community Forum Index -> Archive 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