mIRC Home    About    Download    Register    News    Help

Topic Options
#131291 - 28/09/05 04:47 AM flood control for an on 1:text: script
barkums Offline
Nutrimatic drinks dispenser

Registered: 28/09/05
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.

Top
#131292 - 28/09/05 06:53 AM Re: flood control for an on 1:text: script
MikeChat Offline
Hoopy frood

Registered: 12/12/02
Posts: 1245
Loc: California, doooood
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

Top
#131293 - 28/09/05 10:12 AM Re: flood control for an on 1:text: script
Kelder Offline
Hoopy frood

Registered: 12/04/03
Posts: 701
Loc: Leuven, Belgium
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
}

Top
#131294 - 28/09/05 04:23 PM Re: flood control for an on 1:text: script
barkums Offline
Nutrimatic drinks dispenser

Registered: 28/09/05
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

Top
#131295 - 28/09/05 04:39 PM Re: flood control for an on 1:text: script
Kelder Offline
Hoopy frood

Registered: 12/04/03
Posts: 701
Loc: Leuven, Belgium
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

Top
#131296 - 28/09/05 10:04 PM Re: flood control for an on 1:text: script
barkums Offline
Nutrimatic drinks dispenser

Registered: 28/09/05
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.

Top
#131297 - 28/09/05 10:35 PM Re: flood control for an on 1:text: script
MikeChat Offline
Hoopy frood

Registered: 12/12/02
Posts: 1245
Loc: California, doooood
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.

Top
#131298 - 29/09/05 06:51 AM Re: flood control for an on 1:text: script
Darwin_Koala Offline
Fjord artisan

Registered: 21/02/04
Posts: 206
Loc: Canberra, Australia
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!

Top
#131299 - 29/09/05 07:14 AM Re: flood control for an on 1:text: script
MikeChat Offline
Hoopy frood

Registered: 12/12/02
Posts: 1245
Loc: California, doooood
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)

Top
#131300 - 29/09/05 01:53 PM Re: flood control for an on 1:text: script
Riamus2 Offline
Planetary brain

Registered: 13/10/04
Posts: 8327
Loc: MA, USA
It will, but it will also be slower (though not noticeably).
_________________________
Invision Support
#Invision on irc.irchighway.net

Top
#131301 - 05/10/05 07:55 PM Re: flood control for an on 1:text: script
barkums Offline
Nutrimatic drinks dispenser

Registered: 28/09/05
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.

Top
#131302 - 05/10/05 07:59 PM Re: flood control for an on 1:text: script
Riamus2 Offline
Planetary brain

Registered: 13/10/04
Posts: 8327
Loc: MA, USA
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

Top
#131303 - 05/10/05 08:26 PM Re: flood control for an on 1:text: script
barkums Offline
Nutrimatic drinks dispenser

Registered: 28/09/05
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.

Top