mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Dec 2015
Posts: 6
F
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
F
Joined: Dec 2015
Posts: 6
I'm really new to coding in this program and have very minimal knowledge. I have made a list of commands but I want them to all go on cooldown so that they can only be used once every 15 seconds or so. all of them. I have 50 commands but I only want them to be available for use around every 15 seconds. With the exception of me.
My $nick is BlueFireGaminz

Last edited by Fulcrum13; 09/12/15 02:55 AM.
Joined: Aug 2003
Posts: 325
W
Fjord artisan
Offline
Fjord artisan
W
Joined: Aug 2003
Posts: 325
Okay is that 15 seconds each or 15 seconds global? As in, no duplicate commands within 15 seconds or only one command within 15 seconds?

Joined: Dec 2014
Posts: 6
S
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
S
Joined: Dec 2014
Posts: 6
Code:
if ((%floodschutz) || ($($+(%,floodschutz.,$nick),2))) { return }
set -z %floodschutz. $+ $nick 15

Joined: Dec 2015
Posts: 6
F
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
F
Joined: Dec 2015
Posts: 6
Globally one per 15 seconds. So only one command every 15 seconds.

Joined: Dec 2015
Posts: 6
F
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
F
Joined: Dec 2015
Posts: 6
Originally Posted By: SchmantFRED
Code:
if ((%floodschutz) || ($($+(%,floodschutz.,$nick),2))) { return }
set -z %floodschutz. $+ $nick 15

This, as far as I can work out with my minimal knowledge, makes it so that a single command can only be used once every 15 seconds. But I am using my bot on a very active twitch channel and would like to have it so that nobody can use it more than once in a 15 second span of time. So that people can use the bot only 4 times per minute.
Code:
on *:TEXT:!quote:#: { msg $chan There are currently 31 numbered quotes! And there are 18 secret ones too!! 49 in total! 
  if ((%floodschutz) || ($($+(%,floodschutz.,$nick),2))) { return }
set -z %floodschutz. $+ $nick 15 }

This is what a string of my code would look like if I added this to it.

Joined: Dec 2014
Posts: 6
S
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
S
Joined: Dec 2014
Posts: 6
Code:
on *:TEXT:!quote:#: { 
  if (%floodschutz) { return }
set -z %floodschutz 15
msg $chan There are currently 31 numbered quotes! And there are 18 secret ones too!! 49 in total! 
 }


this should work. thought you mean a person is only allowed to use a command every 15 sec. but if you want that only one person can use a command and then noone else in 15 sec. then use the code above

Joined: Aug 2003
Posts: 325
W
Fjord artisan
Offline
Fjord artisan
W
Joined: Aug 2003
Posts: 325
Originally Posted By: Fulcrum13
Code:
on *:TEXT:!quote:#: { msg $chan There are currently 31 numbered quotes! And there are 18 secret ones too!! 49 in total! 
  if ((%floodschutz) || ($($+(%,floodschutz.,$nick),2))) { return }
set -z %floodschutz. $+ $nick 15 }

Let's tweak this up some...

Code:
ON *:TEXT:*:#:{
  var %antiflood = $+(%,.,$cid,.antiflood), %command = $+(command.,$1)

  if ( [ [ %antiflood ] ] && !$istok($me (someOtherNickOfYourChoice),32) ) { return }
  if ( !$istok($command.channels($nick),$chan,32) || *.twitch.tv !iswm $server ) { return }
  

  if ( !* !iswm $1 || !$isalias(%command) ) { return }

  SET -eu15 [ [ %antiflood ] ] $true

  %command $2-
}

alias command.channels {
  if ( $me == botNameOne ) { return #channel1 #channel2 #channel3 }
}

alias command.!quote msg $chan There are currently 31 numbered quotes! And there are 18 secret ones too!! 49 in total!

This will allow you to have multiple connections, limit which channels it will respond to per connection (based on the nick), let you bypass the flood control (if you want), and only have to check the flood control once instead of doing it in multiple ON TEXT functions. The antiflood will last for 15 seconds after the last command execution and also the timer gets reset if mirc should be closed for any reason as an extra precaution.

Could make it even fancier by having certain exceptions per channel and per bot, but I'm sure this will suit your needs as it is. smile


Link Copied to Clipboard