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 

Possible to count 2 things with one trigger?

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


Joined: 13 Jul 2006
Posts: 3

PostPosted: Thu Jul 13, 2006 3:11 pm    Post subject: Possible to count 2 things with one trigger? Reply with quote

I'm currently trying to make a script that will count the voiced users in a specific chan, and also count the lines of a vertain file, and then display them both in one line like

There are x users and there are x lines in the file.

Thats just a short rundown, this is what I have so far.

Code:
bind pub - !stats voiced


proc voiced {nick uhost hand chan arg} {
 set i 0
set cname #chan
 foreach n [chanlist $cname] {
  if {[isvoice $n $cname]} { incr i }
 }
 puthelp "privmsg $chan :There are currently $i voices online!"
}
Back to top
View user's profile Send private message
avilon
Halfop


Joined: 13 Jul 2004
Posts: 64
Location: Germany

PostPosted: Thu Jul 13, 2006 5:08 pm    Post subject: Reply with quote

Code:
bind pub - !stats voiced

proc voiced {nick uhost hand chan arg} {
   
   set i 0
   set cname #chan
   foreach n [chanlist $cname] {
      if { [isvoice $n $cname] } {
         incr i
      }
   }
   
   set fname "path/to/file.txt"
   set fs [open $fname r]
   set data [read $fs]
   close $fs
   set lines [split $data \n]
   set length [llength $lines]
   
   puthelp "PRIVMSG $chan :There are currently $i voices online and $length lines in ${fname}!"
   return
}
Back to top
View user's profile Send private message
shag
Voice


Joined: 13 Jul 2006
Posts: 3

PostPosted: Thu Jul 13, 2006 5:23 pm    Post subject: Reply with quote

Wow man thanks I was trying to use set i 0 again and like change it to a different letter. Thanks for the help works great apreciate it greatly!
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