mIRC Home    About    Download    Register    News    Help

Print Thread
How to avoid flooding kicks #266074 18/09/19 07:14 AM
Joined: Nov 2017
Posts: 19
G
goblin58 Offline OP
Pikka bird
OP Offline
Pikka bird
G
Joined: Nov 2017
Posts: 19
Hi Everyone,

I have a bot that can output a lot of data and at times and it must hit the SENDQ max and the bot is killed.

Is there a way to buffer the output to avoid this. I have tried using a timer to actually do the output but I still get kicked. Maybe there is another way to do this, I am not sure.

Here is my sample code:
Code
alias Test {
    var %data = The quick brown fox jumps over the lazy dog
    var %count = 500
    var %index = 1

    if ($hget(buffer.data)) hfree buffer.data
    hmake buffer.data 1

    clear
    while (%index <= %count) {
        hadd buffer.data %index %data
        inc %index
    }
    noop $OutputBuffer(buffer.data, #chill)
}

alias OutputBuffer {
    set %OutputBuffer.Count $hget($1, 0).item
    set %OutputBuffer.Bytes 0

    TimedOutput $1 $2
    .timerOutput -q 0 2 TimedOutput $1 $2
}

alias TimedOutput {
    while (%OutputBuffer.Count > 0) {
        var %data = $hget($1, %OutputBuffer.Count).data -> %OutputBuffer.Bytes
        %OutputBuffer.Bytes = $calc(%OutputBuffer.Bytes + $len(%data))
        msg $2 %data
        dec %OutputBuffer.Count
        if (%OutputBuffer.Bytes > 511) {
            set %OutputBuffer.Bytes 0
            return
        }
        if (%OutputBuffer.Count < 1) .timerOutput -q off
    }
}


Hopefully someone has encountered this before and has a solution.

Re: How to avoid flooding kicks [Re: goblin58] #266075 18/09/19 07:18 AM
Joined: Nov 2017
Posts: 19
G
goblin58 Offline OP
Pikka bird
OP Offline
Pikka bird
G
Joined: Nov 2017
Posts: 19
Oh, I just noticed, this should probably be outside the while loop
Code
if (%OutputBuffer.Count < 1) .timerOutput -q off

Re: How to avoid flooding kicks [Re: goblin58] #266085 18/09/19 07:48 PM
Joined: Feb 2003
Posts: 2,662
Raccoon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,662
I am unfamiliar with the /timer -q switch.


Well. At least I won lunch.
Good philosophy, see good in bad, I like!
Re: How to avoid flooding kicks [Re: Raccoon] #266086 19/09/19 06:30 AM
Joined: Nov 2017
Posts: 19
G
goblin58 Offline OP
Pikka bird
OP Offline
Pikka bird
G
Joined: Nov 2017
Posts: 19
My bad, got languages mixed up. Delete the -q.