mIRC Home    About    Download    Register    News    Help

Print Thread
flood control for an on 1:text: script #131291 28/09/05 03:47 AM
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.

Re: flood control for an on 1:text: script #131292 28/09/05 05:53 AM
Joined: Dec 2002
Posts: 1,245
M
MikeChat Offline
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

Re: flood control for an on 1:text: script #131293 28/09/05 09:12 AM
Joined: Apr 2003
Posts: 701
K
Kelder Offline
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
}

Re: flood control for an on 1:text: script #131294 28/09/05 03:23 PM
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

Re: flood control for an on 1:text: script #131295 28/09/05 03:39 PM
Joined: Apr 2003
Posts: 701
K
Kelder Offline
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

Re: flood control for an on 1:text: script #131296 28/09/05 09:04 PM
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.

Re: flood control for an on 1:text: script #131297 28/09/05 09:35 PM
Joined: Dec 2002
Posts: 1,245
M
MikeChat Offline
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.

Re: flood control for an on 1:text: script #131298 29/09/05 05:51 AM
Joined: Feb 2004
Posts: 206
D
Darwin_Koala Offline
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!
Re: flood control for an on 1:text: script #131299 29/09/05 06:14 AM
Joined: Dec 2002
Posts: 1,245
M
MikeChat Offline
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)

Re: flood control for an on 1:text: script #131300 29/09/05 12:53 PM
Joined: Oct 2004
Posts: 8,327
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,327
It will, but it will also be slower (though not noticeably).


Invision Support
#Invision on irc.irchighway.net
Re: flood control for an on 1:text: script #131301 05/10/05 06:55 PM
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.

Re: flood control for an on 1:text: script #131302 05/10/05 06:59 PM
Joined: Oct 2004
Posts: 8,327
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,327
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
Re: flood control for an on 1:text: script #131303 05/10/05 07:26 PM
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.