mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Sep 2005
Posts: 6
B
barkums Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
B
Joined: Sep 2005
Posts: 6
Is there a script or code that will limit how many times people can trigger an on 1:text: script? Say someone types the trigger five times in a row, I want it to disable for, say, 30-60 seconds before they can trigger it again.

Thanks for any help.

Joined: Dec 2002
Posts: 1,245
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
you can set a global %var and test for it before the script can do the rest

on *TEXT:*Blah*:#yourchannel: {
if (%stop-script) { return }
elseif (!%stop_script) {
set -u60 %stop_script 1
do stuff
}
}

along those lines

Joined: Apr 2003
Posts: 701
K
Hoopy frood
Offline
Hoopy frood
K
Joined: Apr 2003
Posts: 701
No need for the elseif, if it isn't true it's false and the return does stop further processing of the script.

on *TEXT:*Blah*:#yourchannel: {
if (%stop_script) { return }
set -u60 %stop_script 1
do stuff
}

Joined: Sep 2005
Posts: 6
B
barkums Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
B
Joined: Sep 2005
Posts: 6
Could you make it so you are talking to a total scripting/programming dummy? grin Does that go in the SAME script? Does anything in the code you gave me need to change (e.g. words) to work? Say like the script is named bf2ar.mrc

Joined: Apr 2003
Posts: 701
K
Hoopy frood
Offline
Hoopy frood
K
Joined: Apr 2003
Posts: 701
These 2 lines need to be put in the same script that you want protected, and right under the on *:TEXT trigger:

if (%stop_script) { return }
set -u60 %stop_script 1

Change the green %variable name to something that's appropriate for your script, maybe %floodprot_pizzatrigger or %flood_seenscript
The red number is the number of seconds you want the script to do nothing after being triggered.

ps: google for mIRC script tutorials or try stuff out yourself, once you get the hang of it, it's fun smile

Joined: Sep 2005
Posts: 6
B
barkums Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
B
Joined: Sep 2005
Posts: 6
I must be doing something wrong, because it's not working. Do I have to set the variable somewhere? I really am a dummy when it comes to this sort of thing.

Joined: Dec 2002
Posts: 1,245
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
on *TEXT:*Blah*:#yourchannel: {
if (%stop_script) { return }
set -u60 %stop_script 1

the
rest
of
the
script
here


}

the var is SET in the line of Green text
but it is important to check to see if the var is Set before setting it, as you see in the Blue text
then the rest of your script would be in there as normal as represented by the Red text.

Joined: Feb 2004
Posts: 206
D
Fjord artisan
Offline
Fjord artisan
D
Joined: Feb 2004
Posts: 206
Quote:


<...>

if (%stop_script) { return }
set -u60 %stop_script 1

<...>


Would:
Code:
 
 $iif (%stop_script, return, set -u60 %stop_script 1)


work as well in this context?

Cheers,

DK


Darwin_Koala

Junior Brat, In-no-cent(r)(tm) and original source of DK-itis!
Joined: Dec 2002
Posts: 1,245
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
I tested that in this
Code:
on *:text:!search *:#: {
  $iif(%flood_checking,return,set -u10 %flood_checking 1)
  filter -ffc[color:green] FILE.TXT[/color] tmp $replace($+(*,$2-,*),$chr(32),$chr(42)) 
  if ($filtered) .play -m1q3 $nick tmp $calc($lines(tmp) * 80)
}


worked fine (replacing FILE.TXT with an actual file)

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
It will, but it will also be slower (though not noticeably).


Invision Support
#Invision on irc.irchighway.net
Joined: Sep 2005
Posts: 6
B
barkums Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
B
Joined: Sep 2005
Posts: 6
I wish I wasn't such a dummy when it came to scripting/coding/programming. When I coded HTML, I could get the gist of what javascript would do, but all this is beyond me.

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
You're also looking at some more advanced scripting. If you're new to scripting, trying to figure this out would be difficult. You're better of trying with more basic scripting first and work your way up. Then, this becomes very easy to read. laugh


Invision Support
#Invision on irc.irchighway.net
Joined: Sep 2005
Posts: 6
B
barkums Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
B
Joined: Sep 2005
Posts: 6
Well, I finally got it to work. I was adding the code to the wrong place. It's not EXACTLY what I wanted, but it works all the same. Thanks for everyone's help. It's much appreciated.


Link Copied to Clipboard