mIRC Home    About    Download    Register    News    Help

Print Thread
#241412 18/04/13 06:35 PM
Joined: Apr 2013
Posts: 2
G
Bowl of petunias
OP Offline
Bowl of petunias
G
Joined: Apr 2013
Posts: 2
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

Joined: Jun 2007
Posts: 933
5
Hoopy frood
Offline
Hoopy frood
5
Joined: Jun 2007
Posts: 933
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).

Joined: Apr 2013
Posts: 2
G
Bowl of petunias
OP Offline
Bowl of petunias
G
Joined: Apr 2013
Posts: 2
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?

Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Shouldn't the correct format be:
Code:
set -u1 %silent 1

Joined: Oct 2012
Posts: 164
D
Vogon poet
Offline
Vogon poet
D
Joined: Oct 2012
Posts: 164
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.

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
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.


Invision Support
#Invision on irc.irchighway.net

Link Copied to Clipboard