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.
Help for those learning Tcl or writing their own scripts.
Koepi
Voice
Posts: 26 Joined: Sun Aug 31, 2003 1:21 am
Post
by Koepi » Sat Dec 03, 2005 3:21 pm
I count the number of users in my channel with
Code: Select all
set anzahl [expr [llength [chanlist $chan]]]
i have a txt file, user.txt. every nick in the channel who is in this file should be decrease from the number of users.
user.txt
I hope you understand what i mean and can help me.
greets Koepi
demond
Revered One
Posts: 3073 Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:
Post
by demond » Sat Dec 03, 2005 4:18 pm
Code: Select all
set count [llength [chanlist $chan]]
foreach n [split [read [open user.txt]] \n] {
if {[onchan $n $chan]} {incr count -1}
}
connection, sharing, dcc problems? click
<here>
before asking for scripting help, read
<this>
use
Koepi
Voice
Posts: 26 Joined: Sun Aug 31, 2003 1:21 am
Post
by Koepi » Sun Dec 04, 2005 2:58 pm
thx, works fine
Sir_Fz
Revered One
Posts: 3794 Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:
Post
by Sir_Fz » Sun Dec 04, 2005 3:18 pm
The file should be closed though.
Code: Select all
set count [llength [chanlist $chan]]
foreach n [split [read [set f [open user.txt]]] \n][close $f] {
if {[onchan $n $chan]} {incr count -1}
}
Koepi
Voice
Posts: 26 Joined: Sun Aug 31, 2003 1:21 am
Post
by Koepi » Sun Dec 04, 2005 3:52 pm
Okay thx. Is integrated, but you explan me what does this do?
Sir_Fz
Revered One
Posts: 3794 Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:
Post
by Sir_Fz » Sun Dec 04, 2005 4:15 pm
It's the same script, but this one closes the file after reading it in order not to open too many files which will lead to errors if excess files has been opened.
Koepi
Voice
Posts: 26 Joined: Sun Aug 31, 2003 1:21 am
Post
by Koepi » Sun Dec 04, 2005 4:49 pm
Okay, thanks.