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.

+v

Old posts that have not been replied to for several years.
Locked
D
DeadGuy

+v

Post by DeadGuy »

Is there any tcl out there that voice users when they say about 5lines of text in under 1 min instead of juz a line.

If there isn't any, what will I need to do? Pls give pointers cos I'm new with this tcl stuff.

Thanks
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

I was bored...

Post by user »

...so if you still need it, here's something to start with
(cNv == count'n'voice :P)

Code: Select all

set cNv(msgs:time) 5:60
bind pubm - "#chan *" cNv
proc cNv {n u h c a} {
	if {[isvoice $n $c]||[isop $n $c]} return
	global cNv
	scan $cNv(msgs:time) %i:%i num sec
	lappend cNv($c,$u) [expr {[clock seconds]+$sec}]
	if {[llength $cNv($c,$u)]>=$num} {
		set ts $cNv($c,$u); set cNv($c,$u) {}
		foreach ts $ts {
			if {$ts>[clock seconds]} {lappend cNv($c,$u) $ts}
		}
		if {[llength $cNv($c,$u)]>=$num} {
			pushmode $c +v $n; unset cNv($c,$u)
		}
	}
}
Instead of polluting the code with comments I thought I'd let you ask questions to keep me entertained.
D
DeadGuy

Post by DeadGuy »

First of all thanks for the code :D , and yes, I'm not sure what some of the lines does esp these few lines.

Code: Select all

scan $cNv(msgs:time) %i:%i num sec 
   lappend cNv($c,$u) [expr {[clock seconds]+$sec}] 
   if {[llength $cNv($c,$u)]>=$num} { 
      set ts $cNv($c,$u); set cNv($c,$u) {} 
      foreach ts $ts { 
         if {$ts>[clock seconds]} {lappend cNv($c,$u) $ts} 
      } 
and if I'm going to make the bot not to +v users that are on certain channel (ban channel that the bot is not in) should i add these?

Code: Select all

if {[isvoice $n $c]||[isop $n $c]||[onchan $n #abc]} return 
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

I think if u add this code:

Code: Select all

if {([string match $c "#chan"])} {return 0}
before the if {[llength.... it should work.
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

DeadGuy wrote:if I'm going to make the bot not to +v users that are on certain channel (ban channel that the bot is not in) should i add these?
If your bot is not on the channel, 'onchan' won't work. The only way to find out is by doing a /whois on the user and that would be an entirely different matter. This can't be done on-the-fly inside the cNv proc because you have to send the whois request and then wait for the response from the irc server. The best thing would be to add a whois proc that does /whois on the last joiners on a set time interval then check if they're in the banned channel(s) and exempt them from voicing some how.
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

DeadGuy wrote:I'm not sure what some of the lines does esp these few lines.

Code: Select all

scan $cNv(msgs:time) %i:%i num sec 
   lappend cNv($c,$u) [expr {[clock seconds]+$sec}] 
   if {[llength $cNv($c,$u)]>=$num} { 
      set ts $cNv($c,$u); set cNv($c,$u) {} 
      foreach ts $ts { 
         if {$ts>[clock seconds]} {lappend cNv($c,$u) $ts} 
      } 
The scan extracts the integers from the string stored in the variable and put them into 'num' and 'sec' for easy access later in the script.

The concept of the counting mechanism is a list of timestamps of when people say something in the channel..if the length of this list becomes >= the voice threshold you specified the values in this list is further investigated. Values that have expired are deleted. (or rather..all values are deleted and only the non-expired ones are added back)
D
DeadGuy

Post by DeadGuy »

Ok got it thanks! :D
Locked