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.

[Solved]Stacked kicks without queue

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
Online
s
simo
Revered One
Posts: 1073
Joined: Sun Mar 22, 2015 2:41 pm

[Solved]Stacked kicks without queue

Post by simo »

Hey there,

I was looking at caesar's stacked kicks proc
From the clone kicker thread

Code: Select all

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.
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

'send now' vs 'hold in queue'

Post by SpiKe^^ »

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
.
Online
s
simo
Revered One
Posts: 1073
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

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.
Online
s
simo
Revered One
Posts: 1073
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

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
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

qkick ver 0.1

Post by SpiKe^^ »

Code: Select all

##########################################################

##  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
.
Online
s
simo
Revered One
Posts: 1073
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

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.
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Just remove the:

Code: Select all

set qwhy "Go away." 
and replace:

Code: Select all

proc qkick {ch {nk ""}} {  global qkick 
with:

Code: Select all

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.
Online
s
simo
Revered One
Posts: 1073
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

i tried your suggestion caesar and it returned this error:

wrong # args: should be "qkick ch ?nk? ?qwhy?"
when i used it like this : qkick $chan $nick .testing this
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

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.
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

qkick ver 0.2

Post by SpiKe^^ »

Caesar:

Good try caesar, but that wont use the custom reason when the proc is called by the timer...

Code: Select all

    utimer $qsec [list qkick $ch]

Could fix that issue by making the line above look more like...

Code: Select all

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

##########################################################

##  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."

Last edited by SpiKe^^ on Mon May 25, 2020 1:00 pm, edited 2 times in total.
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
Online
s
simo
Revered One
Posts: 1073
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

i tried your last posted one spike^^

with :

qkick $chan $nick testing this


and it kept returning :
wrong # args: should be "qkick ch ?nk? ?wy?"
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

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
.
Online
s
simo
Revered One
Posts: 1073
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

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