| View previous topic :: View next topic |
| Author |
Message |
Koepi Voice
Joined: 31 Aug 2003 Posts: 26
|
Posted: Sat Dec 03, 2005 3:21 pm Post subject: number of users |
|
|
I count the number of users in my channel with
| Code: | | 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 |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Sat Dec 03, 2005 4:18 pm Post subject: |
|
|
| Code: |
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 [code] tag when posting logs, code |
|
| Back to top |
|
 |
Koepi Voice
Joined: 31 Aug 2003 Posts: 26
|
Posted: Sun Dec 04, 2005 2:58 pm Post subject: |
|
|
thx, works fine  |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Sun Dec 04, 2005 3:18 pm Post subject: |
|
|
The file should be closed though.
| Code: | set count [llength [chanlist $chan]]
foreach n [split [read [set f [open user.txt]]] \n][close $f] {
if {[onchan $n $chan]} {incr count -1}
} |
_________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
Koepi Voice
Joined: 31 Aug 2003 Posts: 26
|
Posted: Sun Dec 04, 2005 3:52 pm Post subject: |
|
|
| Okay thx. Is integrated, but you explan me what does this do? |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Sun Dec 04, 2005 4:15 pm Post subject: |
|
|
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. _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
Koepi Voice
Joined: 31 Aug 2003 Posts: 26
|
Posted: Sun Dec 04, 2005 4:49 pm Post subject: |
|
|
| Okay, thanks. |
|
| Back to top |
|
 |
|