mIRC Homepage
Posted By: gomorrah on JOIN flood protection - 18/04/13 06:35 PM
Hi guys, first time poster and I need a little help... it's been a long time since I scripted in mIRC and I'm a little rusty, and I'm sure even this basic code (which works) is a little outdated.

What I have is a simple on JOIN script, but I want to add a flood protection to it... say, a 5-10 minute interval to protect me from a join/part flood. Here is basic script I have going on (this is just example)-

on 1:join:#:{
if (gomorrah == $nick) {
.msg $chan did welcome back $nick }
}

How can i set up a time variable (or lines of script) that that tells the entire script to execute ONLY when the time that's passed is greater than the time set in, say, %timeexpire ?? If this is confusing, i apologize... and if my script is outdated i apologize as well, but like I said it's been years... almost 10 years ha.

Thanks for your help in advance smile
Posted By: 5618 Re: on JOIN flood protection - 18/04/13 07:15 PM
Something basic would be:
Code:
on !1:JOIN:#:{
  if (gomorrah == $nick) {
    if (!%silent) {
      .msg $chan did welcome back $nick
      set -u $+ %timeexpire %silent 1
    }
  }
}

Note that this does not check whether %timeexpire has a valid numerical value (in seconds).
Posted By: gomorrah Re: on JOIN flood protection - 18/04/13 08:53 PM
i get this error:

"* /set: invalid parameters (line 5, remote.ini)"

%timeexpire is already set at 300 (5 minutes) and i was using it to represent how long i want the interval of this remote NOT to execute the ".msg $chan" line from the original $nick join.

what was "%silent" supposed to represent? if i'm reading the code right (again, i'm rusty, i apologize in advance), one of those two values is supposed to be incrementing by 1 every second, correct?
Posted By: Tomao Re: on JOIN flood protection - 18/04/13 10:30 PM
Shouldn't the correct format be:
Code:
set -u1 %silent 1
Posted By: Deega Re: on JOIN flood protection - 18/04/13 11:35 PM
Originally Posted By: gomorrah
i get this error:

"* /set: invalid parameters (line 5, remote.ini)"

Change the set line to
Code:
set $+(-u,%timeexpire) %silent 1



Originally Posted By: gomorrah
what was "%silent" supposed to represent? if i'm reading the code right (again, i'm rusty, i apologize in advance), one of those two values is supposed to be incrementing by 1 every second, correct?

The code looks to see if %silent is NOT set (!%silent). The -u switch makes %silent unset itself after %timeexpired seconds.
Posted By: Riamus2 Re: on JOIN flood protection - 19/04/13 12:49 AM
Basic flood protection scripts use a format like the one shown. You basically use a variable to determine if you recently reacted to the trigger. If the variable is set, you don't react. If the variable is not set, you do react. You simply set the variable to unset within a certain period of time (the -u part). It doesn't matter what you set the variable to - 1 in the script above - just as long as it is set to something. When the timer runs out, you'll react to the script's trigger again. You can, of course, modify it in a variety of ways such as making it so you react X times in a certain amount of time and then stop reacting - instead of only once in the time period. It all depends on what your needs are. But the basic format is usually where you would start.
© mIRC Discussion Forums