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 

number of users

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


Joined: 31 Aug 2003
Posts: 26

PostPosted: Sat Dec 03, 2005 3:21 pm    Post subject: number of users Reply with quote

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
Code:
user1
user2
user3


I hope you understand what i mean and can help me.

greets Koepi
Back to top
View user's profile Send private message
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Sat Dec 03, 2005 4:18 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Koepi
Voice


Joined: 31 Aug 2003
Posts: 26

PostPosted: Sun Dec 04, 2005 2:58 pm    Post subject: Reply with quote

thx, works fine Smile
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Sun Dec 04, 2005 3:18 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Koepi
Voice


Joined: 31 Aug 2003
Posts: 26

PostPosted: Sun Dec 04, 2005 3:52 pm    Post subject: Reply with quote

Okay thx. Is integrated, but you explan me what does this do?
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Sun Dec 04, 2005 4:15 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Koepi
Voice


Joined: 31 Aug 2003
Posts: 26

PostPosted: Sun Dec 04, 2005 4:49 pm    Post subject: Reply with quote

Okay, thanks.
Back to top
View user's profile Send private message
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