egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[Solved]Stacked kicks without queue

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
simo
Master


Joined: 22 Mar 2015
Posts: 485

PostPosted: Sat May 23, 2020 1:32 am    Post subject: [Solved]Stacked kicks without queue Reply with quote

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.
_________________
Coming together is a beginning, staying together is progress, working together is succes.


Last edited by simo on Mon May 25, 2020 12:38 pm; edited 1 time in total
Back to top
View user's profile Send private message
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 634
Location: Tennessee, USA

PostPosted: Sat May 23, 2020 3:31 am    Post subject: 'send now' vs 'hold in queue' Reply with quote

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
View user's profile Send private message Visit poster's website
simo
Master


Joined: 22 Mar 2015
Posts: 485

PostPosted: Sat May 23, 2020 3:58 am    Post subject: Reply with quote

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
_________________
Coming together is a beginning, staying together is progress, working together is succes.


Last edited by simo on Sun May 24, 2020 12:01 am; edited 2 times in total
Back to top
View user's profile Send private message
simo
Master


Joined: 22 Mar 2015
Posts: 485

PostPosted: Sat May 23, 2020 9:23 pm    Post subject: Reply with quote

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
_________________
Coming together is a beginning, staying together is progress, working together is succes.
Back to top
View user's profile Send private message
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 634
Location: Tennessee, USA

PostPosted: Sun May 24, 2020 6:49 pm    Post subject: qkick ver 0.1 Reply with quote

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
View user's profile Send private message Visit poster's website
simo
Master


Joined: 22 Mar 2015
Posts: 485

PostPosted: Mon May 25, 2020 8:10 am    Post subject: Reply with quote

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^^
_________________
Coming together is a beginning, staying together is progress, working together is succes.


Last edited by simo on Mon May 25, 2020 8:19 am; edited 1 time in total
Back to top
View user's profile Send private message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3651
Location: Mint Factory

PostPosted: Mon May 25, 2020 9:30 am    Post subject: Reply with quote

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
View user's profile Send private message
simo
Master


Joined: 22 Mar 2015
Posts: 485

PostPosted: Mon May 25, 2020 9:37 am    Post subject: Reply with quote

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
_________________
Coming together is a beginning, staying together is progress, working together is succes.
Back to top
View user's profile Send private message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3651
Location: Mint Factory

PostPosted: Mon May 25, 2020 9:51 am    Post subject: Reply with quote

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
View user's profile Send private message
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 634
Location: Tennessee, USA

PostPosted: Mon May 25, 2020 11:39 am    Post subject: qkick ver 0.2 Reply with quote

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
View user's profile Send private message Visit poster's website
simo
Master


Joined: 22 Mar 2015
Posts: 485

PostPosted: Mon May 25, 2020 11:59 am    Post subject: Reply with quote

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?"

_________________
Coming together is a beginning, staying together is progress, working together is succes.
Back to top
View user's profile Send private message
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 634
Location: Tennessee, USA

PostPosted: Mon May 25, 2020 12:08 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
simo
Master


Joined: 22 Mar 2015
Posts: 485

PostPosted: Mon May 25, 2020 12:11 pm    Post subject: Reply with quote

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
_________________
Coming together is a beginning, staying together is progress, working together is succes.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber