mIRC Home    About    Download    Register    News    Help

Topic Options
#264779 - 11/01/19 06:04 PM anti-flood
raven Offline
Nutrimatic drinks dispenser

Registered: 24/11/18
Posts: 6
Loc: Sweden
Can someone help me with a anti-flood? I have a simple trigger:

on 1:TEXT:hello*:#:/say $chan Welcome to $chan $nick!

But I want a flood protection to that, restricting it to one line every 10 seconds..

Top
#264780 - 11/01/19 07:06 PM Re: anti-flood [Re: raven]
maroon Offline
Hoopy frood

Registered: 12/01/04
Posts: 1036
Are you wanting to reply only if you have not replied within the past 10 seconds?
Or have a queue window that stores up your replies and eventually spits them out at 10 seconds intervals?

If the former, see this thread.

If the latter, it can quickly get complicated if you need to track nick changes or if the target has even remained in the channel.

Top
#264794 - 12/01/19 01:13 PM Re: anti-flood [Re: maroon]
raven Offline
Nutrimatic drinks dispenser

Registered: 24/11/18
Posts: 6
Loc: Sweden
on !1:TEXT:Hello:#mychan:{
if (!%comwait) {
set -u10 %comwait 1
Hey $nick
}
else echo Flood triggered, 10 seconds cooldown
}

Would that give me a 10 seconds cooldown?

Top
#264800 - 13/01/19 03:05 AM Re: anti-flood [Re: raven]
maroon Offline
Hoopy frood

Registered: 12/01/04
Posts: 1036
For "reason", you usually want to use *:TEXT instead of 1:TEXT

You don't need the ! prefix in :TEXT: event which targets a channel, because your own messages in a #channel never trigger the :TEXT: event.

It does set a cooldown that affects everyone. As shown in the link I gave above, you can have a separate cooldown per nick and another cooldown for the channel as a whole.

It's a good idea to have variables which are unlikely to be trampled on by other scripts. If this is just for #mychan, then name the variable %comwait.#mychan

If I were to do this, I'd also use a variable name which didn't look like it was being used in a $com, $comcall, or a sock* event. %cooldown.#mchan would probably be better for when you look at this script for the first time in 6 months.

Unless you have an alias named "Hey", that will be an invalid command that gets sent to the server to see if it recognizes HEY either.

Top