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.

Possible to count 2 things with one trigger?

Help for those learning Tcl or writing their own scripts.
Post Reply
s
shag
Voice
Posts: 3
Joined: Thu Jul 13, 2006 3:07 pm

Possible to count 2 things with one trigger?

Post by shag »

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: Select all

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!"
}
User avatar
avilon
Halfop
Posts: 64
Joined: Tue Jul 13, 2004 6:58 am
Location: Germany

Post by avilon »

Code: Select all

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
}
s
shag
Voice
Posts: 3
Joined: Thu Jul 13, 2006 3:07 pm

Post by shag »

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!
Post Reply