mIRC Homepage


Posted By: raven

anti-flood - 11/01/19 06:04 PM

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..
Posted By: maroon

Re: anti-flood - 11/01/19 07:06 PM

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.
Posted By: raven

Re: anti-flood - 12/01/19 01:13 PM

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?
Posted By: maroon

Re: anti-flood - 13/01/19 03:05 AM

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.
© 2019 mIRC Discussion Forums