| View previous topic :: View next topic |
| Author |
Message |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Sat May 23, 2020 1:32 am Post subject: [Solved]Stacked kicks without queue |
|
|
Hey there,
I was looking at caesar's stacked kicks proc
From the clone kicker thread
| Code: |
proc stackKicks {chan kicklist reason} {
set max 25
set count [llength $kicklist]
while {$count > 0} {
if {$count > $max} {
set users [join [lrange $kicklist 0 [expr {$max - 1}]] ","]
set kicklist [lrange $kicklist $max end]
incr count -$max
} else {
set users [join $kicklist ","]
set count 0
}
puthelp "KICK $chan $users :$reason"
}
}
|
Since this only accepts already stacked kicks to sort them in defined numbers i was wondering if it could be modified to take single nicks and stack them similar like putkick but without the extreme slow queue wich seems to kick in after an amount of nicks has been stacked
Thanx in advance as always.
Last edited by simo on Mon May 25, 2020 12:38 pm; edited 1 time in total |
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Sat May 23, 2020 3:31 am Post subject: 'send now' vs 'hold in queue' |
|
|
Stacking kicks (or bans, or any other modes or messages) requires some sort of queue, to wait slightly to see if another kick is going to come next.
You can use a very short queue, so it seems to be not queued, but still requires a queue:) _________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
. |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Sat May 23, 2020 3:58 am Post subject: |
|
|
That's true spike i was thinking in milliseconds (or as low as possible) for the queue to give proc enough time to stack the nicks
Last edited by simo on Sun May 24, 2020 12:01 am; edited 2 times in total |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Sat May 23, 2020 9:23 pm Post subject: |
|
|
The idea is to have one kickstacker proc doing the stacking and pushing out as much and as fast as possible without being hindered by a long queue (possibly configurable wich the built in putkick isnt) rather then to have every script do it in few additional lines
And possibly to help it stack as quick as possible without relying too much on timers is to have it check if nicks exceed an amount of number then to temp lock chan with +RM only then to proceed and push out all stacked nicks similar as u did in the mass join tcl one |
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Sun May 24, 2020 6:49 pm Post subject: qkick ver 0.1 |
|
|
| Code: |
##########################################################
## qkick ver 0.1 by SpiKe^^ - 24 May 2020
## A possible alternative for the Eggdrop tcl command: ##
## putkick <channel> <nick,nick,...> [reason] ##
## New tcl command: qkick <channel> <nick,nick,...> ##
##########################################################
proc qkick {ch {nk ""}} { global qkick
set qmax 10
set qsec 1
set qwhy "Go away."
if {![validchan $ch]} { return 1 }
set ch [string tolower $ch]
set nkls [split $nk ","]
if {[info exists qkick($ch)] && [llength $qkick($ch)]} {
set nkls [concat $qkick($ch) $nkls]
}
if {$nk eq "" || [llength $nkls]>=$qmax} {
while {[llength $nkls]} {
if {[llength $nkls]<$qmax && $nk ne ""} { break }
if {[llength $nkls]>$qmax} {
set kick [join [lreplace $nkls $qmax end] ","]
set nkls [lrange $nkls $qmax end]
} else {
set kick [join $nkls ","]
set nkls [list]
}
putserv "KICK $ch $kick :$qwhy"
}
}
if {![info exists qkick($ch)]} {
set qkick($ch) $nkls
utimer $qsec [list qkick $ch]
} elseif {$nk eq ""} {
unset qkick($ch)
} else {
set qkick($ch) $nkls
}
return 0
}
|
Try this untested code.
good luck. _________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
. |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Mon May 25, 2020 8:10 am Post subject: |
|
|
tnx for the swift attempt spike i tried it and it seems to work excellently besides the kick message that cant be customized and sent from each script to the qkick proc like:
qkick #channel nick .reason
other than that it does exactly as desired very nice indeed do you think a custom kick reason can be added to this Spike^^
Last edited by simo on Mon May 25, 2020 8:19 am; edited 1 time in total |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Mon May 25, 2020 9:30 am Post subject: |
|
|
Just remove the:
| Code: |
set qwhy "Go away."
|
and replace:
| Code: |
proc qkick {ch {nk ""}} { global qkick
|
with:
| Code: |
proc qkick {ch {nk ""} {qwhy "Go away."}} { global qkick
|
for example. If you don't give a reason the default "Go away." one will be used. _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Mon May 25, 2020 9:37 am Post subject: |
|
|
i tried your suggestion caesar and it returned this error:
| Quote: |
wrong # args: should be "qkick ch ?nk? ?qwhy?" |
when i used it like this : qkick $chan $nick .testing this |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Mon May 25, 2020 9:51 am Post subject: |
|
|
That's cos the qwhy needs to be like "some reason here" (notice the "). _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Mon May 25, 2020 11:39 am Post subject: qkick ver 0.2 |
|
|
Caesar:
Good try caesar, but that wont use the custom reason when the proc is called by the timer... | Code: |
utimer $qsec [list qkick $ch]
|
Could fix that issue by making the line above look more like... | Code: |
utimer $qsec [list qkick $ch "" $qwhy]
|
I chose to address the custom reason issue from another direction.
simo:
This will use the last custom reason provided.
It is possible multiple scripts could be calling this process during a major flood!
| Code: |
##########################################################
## qkick ver 0.2 by SpiKe^^ - 25 May 2020
## A possible alternative for the Eggdrop tcl command: ##
## putkick <channel> <nick,nick,...> [reason] ##
## New tcl command: ##
## qkick <channel> <nick,nick,...> [reason] ##
##########################################################
proc qkick {ch {nk ""} {wy ""}} { global qkick
set qmax 10
set qsec 1
set qwhy "Go away."
if {![validchan $ch]} { return 1 }
set ch [string tolower $ch]
set nkls [split $nk ","]
if {[info exists qkick($ch)] && [llength $qkick($ch)]} {
set nkls [concat $qkick($ch) $nkls]
}
if {$wy ne ""} {
set qwhy $wy
set qkick(why$ch) $wy
} elseif {[info exists qkick(why$ch)]} {
set qwhy $qkick(why$ch)
}
if {$nk eq "" || [llength $nkls]>=$qmax} {
while {[llength $nkls]} {
if {[llength $nkls]<$qmax && $nk ne ""} { break }
if {[llength $nkls]>$qmax} {
set kick [join [lreplace $nkls $qmax end] ","]
set nkls [lrange $nkls $qmax end]
} else {
set kick [join $nkls ","]
set nkls [list]
}
putserv "KICK $ch $kick :$qwhy"
}
}
if {![info exists qkick($ch)]} {
set qkick($ch) $nkls
utimer $qsec [list qkick $ch]
} elseif {$nk eq ""} {
unset qkick($ch)
catch {unset qkick(why$ch)}
} else {
set qkick($ch) $nkls
}
return 0
}
putlog "qkick ver 0.2 loaded."
|
_________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
Last edited by SpiKe^^ on Mon May 25, 2020 1:00 pm; edited 2 times in total |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Mon May 25, 2020 11:59 am Post subject: |
|
|
i tried your last posted one spike^^
with :
qkick $chan $nick testing this
and it kept returning :
| Quote: |
wrong # args: should be "qkick ch ?nk? ?wy?"
|
|
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Mon May 25, 2020 12:08 pm Post subject: |
|
|
That's 4 arguments.
proc qkick requires 2 or 3 args...
Try: qkick $chan $nick "testing this"
Notice the quoting!! _________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
. |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Mon May 25, 2020 12:11 pm Post subject: |
|
|
oh excellent that seems to be working i forgot the "" very nice indeed spike^^
thanx once again for the fine job you did and ceasar as well |
|
| Back to top |
|
 |
|