mIRC Homepage
Posted By: barkums flood control for an on 1:text: script - 28/09/05 03:47 AM
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.
Posted By: MikeChat Re: flood control for an on 1:text: script - 28/09/05 05:53 AM
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
Posted By: Kelder Re: flood control for an on 1:text: script - 28/09/05 09:12 AM
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
}
Posted By: barkums Re: flood control for an on 1:text: script - 28/09/05 03:23 PM
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
Posted By: Kelder Re: flood control for an on 1:text: script - 28/09/05 03:39 PM
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
Posted By: barkums Re: flood control for an on 1:text: script - 28/09/05 09:04 PM
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.
Posted By: MikeChat Re: flood control for an on 1:text: script - 28/09/05 09:35 PM
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.
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
Posted By: MikeChat Re: flood control for an on 1:text: script - 29/09/05 06:14 AM
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)
Posted By: Riamus2 Re: flood control for an on 1:text: script - 29/09/05 12:53 PM
It will, but it will also be slower (though not noticeably).
Posted By: barkums Re: flood control for an on 1:text: script - 05/10/05 06:55 PM
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.
Posted By: Riamus2 Re: flood control for an on 1:text: script - 05/10/05 06:59 PM
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
Posted By: barkums Re: flood control for an on 1:text: script - 05/10/05 07:26 PM
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.
© mIRC Discussion Forums