to creat a utimer checking if the user will get voice/op before dowing anything.
[snip]
Just curious, why would you suggest that, aside from the fun of having a lot of timers running?
NightHawk has shown that one join triggers 14 modes +v in his case. Let us replace those modes by your timers.
Now suppose a small join/part floodnet of 50 bots joins the channel. Then 50 * 14 timers are started (700).
Or for more fun: suppose that that little floodnet joins all 14 channels listed. Then 14 * 50 * 14 timers are started. Which is slightly less than 10.000 timers.
lol, didn't think of that.
but the reason i suggested this, is for example if a user joins the channel and service give him op, or voice (during the 4 seconds) then the bot won't do anything.
also u can make a code to *not* trigger the script on join floods or join/part floods, or u can do a killutimer if exists more than once on same nick... (but I'm not that good)
You're right, you did say you restarted the bot, but not everybody realizes the difference between restarting and rehashing. I was just making sure.
You probably should start over with your code. It's poorly designed right now. When a user joins the channel, you should only voice him on that channel. It doesn't make sense to voice him on all the channels in $voice_chans, because either he's only joined one of them, or he's already been voiced on the others when he joined those. And um, I'd leave out the voice_chan2 var, because it really doesn't make sense. Why is it easier to add a new channel to voice_chan2 than just voice_chans? heh
So, use lsearch to see if $chan is in $voice_chans. If it is, then send the +v for that nick on that channel only.
Also, can the bot voice himself when he joins a channel? When you first join you generally don't have ops, and thus can't voice anybody. So perhaps it would be better to use a mode bind and when the bot does get +o, then send a +v.
# Channels you want to auto-voice Nicks on.
# Multiple channels seperated by spaces.
# set av-chans "#TCLhelp #TCLlovers"
set av-chans "#chan1 #chan2 #chan3 #chan4 #chan5 #chan6 #chan7 #chan8 #chan9 #chan10"
# The Settings below should work well for you, give them a try first
# Set the Max Number of Joins here
set av-limit 3
# During the Number of Seconds here
set av-sec 3
# Set the Number of Seconds to wait before Voicing the Nick here 3
# Do not set this below 1
set av-time 2
bind join - "*" auto:voice
proc auto:voice {nick uhost handle chan} {
global botnick av-chans av-limit av-sec av-time av-ctr av-mode
set chan [string tolower $chan]
if {![botisop $chan]} {
return 0
}
if {![info exists av-ctr([$chan])]} {return 0}
incr av-ctr($chan) 1
utimer $av-sec [list av:dec $chan]
if {$av-ctr($chan) >= $av-limit} {
set av-mode($chan) 0
return 0
} else {
set av-mode($chan) 1
utimer $av-time [list av:voice $nick $chan]
return 0
}
}
proc av:voice {nick chan} {
av-mode
if {$av-mode($chan) == 0} {
return 0
}
if {[onchan $nick $chan] && ![isvoice $nick $chan]} {
pushmode $chan +v $nick
} else {
return 0
}
}
proc av:dec {chan} {
global av-ctr
incr av-ctr($chan) -1
}
foreach chan [string tolower $av-chans] {
if {![info exists av-ctr([string tolower $chan])]} {
set av-ctr([string tolower $chan]) 0
}
if {![info exists av-mode([string tolower $chan])]} {
set av-mode([string tolower $chan]) 1
}
}
I once was an intelligent young man, now i am old and i can not remember who i was.
Sorry its been awhile since my last post. After careful review of the suggestions, and some serioous studying yet again of coding, things are working very smoothly now, bot voices it self, voices users...etc....without the loop that was there, and it has seriously helped reduce the lag issue. Had to separate it into 2 procs, but thats ok, as long as it works better and more efficiently than it was