i tried editing slennox's autolimit tcl to work with pub cmd but it doesn't seem to do well after i did the changes other than that the tcl works fine without it i just wanted it to work for with pub cmd for chan admins to enable incase of floodings and what not and turn off if all cools down as autolimits are spammy in general to keep on non stop
I would appreciate help if from author himself would be even better since it is his code and it works fine thats why i wanted to stick to it and have pub cmd added to enable/disable and if possible add grace and threshold manually as well i seen some autolimit tcls do that but without on join bind (using timers) wich takes ages for it to set chan limit
Please don't revive old topics and post whatever info you want in your own and link to them.
What exactly you want to adjust on the fly? The limit to set (cl_limit)? Limit grace (cl_grace)? Want a adjustable timer (cl_timer) for each channel or one for all will do fine like is in the chanlimit.tcl by Slennox? I'm asking cos he used timer (minutes) and in your code i see you switched to utimer (seconds).
Once the game is over, the king and the pawn go back in the same box.
Adjusting the grace and limit on the fly is easy to implement, but the utimer part will be a bit tricky as would have to kill previous utimer before making and calling a new one.
If nobody jumps on this will do something tomorrow.
Once the game is over, the king and the pawn go back in the same box.
namespace eval autoLimit {
setudef flag autolimit
setudef str limitData
bind join * * [namespace current]::joins
bind pub o|o !adjust [namespace current]::adjust
proc joins {nick uhost hand chan} {
if {![channel get $chan autolimit]} return
if {[isbotnick $nick] || ![botisop $chan]} return
check $chan
}
proc adjust {nick uhost hand chan text} {
if {![channel get $chan autolimit]} return
if {[scan $text {%d%d} limit grace] != 2} {
puthelp "NOTICE $nick :Error, syntax: !adjust <limit:grace> (integer values)"
return
}
channel set $chan limitData "$limit:$grace"
puthelp "NOTICE $nick :Success, channel limit has been set to $limit and grace set to $grace"
check $chan
}
proc check {{chan ""}} {
if {[llength $chan]} {
set chan [string tolower $chan]
if {![channel get $chan autolimit]} return
if {[scan [join [split [channel get $chan limitData] :]] {%d%d} limit grace] != 2} return
set count [llength [chanlist $chan]]
set newlimit [expr $count + $limit]
set cm [getchanmode $chan]
if {[lsearch -exact [split $cm ""] "l"] != -1} {
set currlimit [lindex [split $cm] 1]
} else {
set currlimit 0
}
if {$newlimit == $currlimit} return
if {$newlimit > $currlimit} {
set diff [expr $newlimit - $currlimit]
} else {
set diff [expr $currlimit - $newlimit]
}
if {$diff <= $grace} return
pushmode $chan +l $newlimit
} else {
foreach chan [channels] {
check $chan
}
}
}
proc start args {
utimer 5 [namespace current]::check
}
start
}
Forgot to add the activation/deactivation from channel command so for now do .chanset #channel +autolimit from DCC Chat/telnet. Set the limit and grace with !adjust limit:grace (integer numbers), for example !adjust 3:5, or from DCC Chat/Telnet with .chanset #channel limitData limit:grace (integer numbers).
I could tie an utimer for each channel as well, if that is really needed.
Once the game is over, the king and the pawn go back in the same box.
Let's say for disscussion sake channel has 50 people, channel doesn't have any limits set and settings are: limit 5 and grace 3.
When you first activate it, if there's no limit set it will set the count + limit, meaning 50 + 5. If new people join and the grace limit (meaning count + grace, meaning 50 + 3) isn't reached it won't change the channel limit. As soon as the 4th person joins and the new limit (50+4) is over the grace (53) it will change the channel mode to 59.
[18:47:41] can't read "chan": no such variable
while executing
"channel set $chan limitData "$limit:$grace""
(in namespace eval "::autoLimit" script line 20)
invoked from within
"namespace eval autoLimit {
setudef flag autolimit
setudef str limitData
bind pub o|o !adjust [namespace current]::adjust
bind pub o|o !l..."
(file "scripts2a/autolimit-caesar2a.tcl" line 1)
invoked from within
"source scripts2a/autolimit-caesar2a.tcl"
with what i got so far i dont get any error so far: