mIRC Homepage
Posted By: ohaithar Flood control is conflicting with script - 17/02/11 11:37 PM
Code:
on *:text:*:#mychan: {
  if (%flood) { return }
  set -u5 %flood On
  if ($nick isvoice $chan) || ($nick ishop $chan) || ($nick isop $chan) {
    if ($1 == .vent) || ($1 == !vent) .notice $nick 4Host/Ip:4 ***************1 4Port number:1 ****1
    elseif ($1 == @vent) msg $chan 4Host/Ip: *************** 4Port number:1 ****
  }
}


This is a script that displays ventrillo info for my chan. I don't know why but as long as

Code:
if (%flood) { return }
  set -u5 %flood On 
is in this script it refuses to work, but otherwise it's fine. Can anyone help me to get it working because i know there will be some trouble makers that will try and flood me off the irc
Posted By: hixxy Re: Flood control is conflicting with script - 17/02/11 11:48 PM
The problem is that you're setting %flood whenever anybody says anything in a channel. You need to put set -u5 %flood On inside your if statements like this:

Code:
on *:text:*:#mychan: {
  if (%flood) { return }
  if ($nick isvoice $chan) || ($nick ishop $chan) || ($nick isop $chan) {
    if ($1 == .vent) || ($1 == !vent) { 
      set -u5 %flood on 
      .notice $nick 4Host/Ip:4 ***************1 4Port number:1 ****1
    }
    elseif ($1 == @vent) {
      set -u5 %flood on
      msg $chan 4Host/Ip: *************** 4Port number:1 ****
    }
  }
}
Hmm it's still refusing to work for me. I have another script that's fairly identical and it works no problem.

Code:
on *:TEXT:*:#mychan: { 
  if (%flood) { return }
  set -u5 %flood On
  if ($nick == example1) || ($nick == example2) && ($1- == example3) || ($1- == example4) || ($1- == example5) msg $chan $read(example1.txt)
  elseif ($1- == example6) || ($1- == example8) || ($1- == example7) msg $chan $read(example2.txt)
}


Posted By: Tomao Re: Flood control is conflicting with script - 18/02/11 12:29 AM
This should work and you can do it more efficiently with $istok
Code:
on *:TEXT:*:#mychan: { 
  if (!%flood) {
    set -u5 %flood On
    if ($istok(example1 example2,$nick,32)) {
      if ($istok(example3 example4 example5,$1,32)) {
        msg $chan $read(example1.txt)
      }
      elseif ($istok(example6 example7 example8,$1,32)) {
        msg $chan $read(example2.txt)
      }
    }
  }
}
Tomao could you incorporate that into my first script
Code:
on *:text:*:#mychan: {
  if (%flood) { return }
  set -u5 %flood On
  if ($nick isvoice $chan) || ($nick ishop $chan) || ($nick isop $chan) {
    if ($1 == .vent) || ($1 == !vent) .notice $nick 4Host/Ip:4 ***************1 4Port number:1 ****1
    elseif ($1 == @vent) msg $chan 4Host/Ip: *************** 4Port number:1 ****
  }
}


that second one was just my example of the other one that's working.
Posted By: Tomao Re: Flood control is conflicting with script - 18/02/11 12:39 AM
You first one can be written as follows:
Code:
on $*:text:/^([.!@])vent$/iS:#mychan: {
  if (!%flood) && ($nick !isreg $chan) {
    set -u5 %flood On
    $iif($regml(1) == @,msg $chan,notice $nick) 4Host/Ip: *************** 4Port number:1 ****
  }
}

I just tried that one too and it still refuses to respond. I'm not sure whats going on. frown
Posted By: Tomao Re: Flood control is conflicting with script - 18/02/11 12:58 AM
You need to be at least a halfop or op or above to trigger the script. I thought that was what your initial code had indicated. Place the code in a new remote and make sure your remote is on by entering: /remote on
Posted By: Riamus2 Re: Flood control is conflicting with script - 18/02/11 12:59 AM
Most likely, you have a %flood variable that is set. /unset %flood and try again. It's also a very good idea to use unique variable names that are not likely to appear anywhere else. For example, %vent.flood or something.
Oh, sorry i need it to activate if the person is a voice, hop or op.
Lol your right Riamus2, i changed it to %flood.vent and its working now smile. I'm so stupid lol thanks alot to everyone.
Posted By: Tomao Re: Flood control is conflicting with script - 18/02/11 01:10 AM
I think it'd better you use a dynamic variable. When one script is triggered before %flood.vent's expiration, you won't be able to make another script to respond to you until it's been unset in 5 seconds. This is to assume that you've applied %flood.vent to all the triggers of your scripts.
Code:
on $*:text:/^([.!@])vent$/iS:#MyChan: {
  if (!$(,$+(%,..,flood,..,$chan,..,$cid,..,$network,..,$nick))) && ($nick !isreg $chan) { 
  set -u5 $+(%,..,flood,..,$chan,..,$cid,..,$network,..,$nick) on
    $iif($regml(1) == @,msg $chan,notice $nick) 4Host/Ip: *************** 4Port number:1 ****
  }
}
yeah, that will help a lot, thank you. smile
Posted By: Tomao Re: Flood control is conflicting with script - 18/02/11 01:25 AM
ohaithar, I made a mistake. Please copy it again.
Posted By: Riamus2 Re: Flood control is conflicting with script - 18/02/11 03:51 AM
Lol. Specific enough? smile

Just my opinion, but most flood control for a specific script works well just to have it only allow the command once every X seconds, no matter who uses it. For those, using different variables for each flood check (vent being just for this vent check) is fine. There are times when you want it to allow "everyone" (no limit in other words) to use the command at once, but only allow each person to use it one time every X seconds. For those situations, including $nick in the timer name is very useful. In the first situation, it really isn't necessary. And I really can't see any need to include $cid and probably 99% of the time, $network isn't all that useful and 90% of the time, $chan isn't very useful. But, again, that's just my opinion. It won't hurt to have all of that (or more). smile

As a note, Tomao's flood control would still let you be flooded off of the server. If 10 voiced users all type .vent at once, you're going to get kicked, unless the network is very relaxed in the number of lines per second they allow from someone.
Posted By: Tomao Re: Flood control is conflicting with script - 18/02/11 06:10 AM
Yes, Riamus2 has a valid point. Go back to the one using %vent.flood var. It's more suitable. We can't be too careful these days.
© mIRC Discussion Forums