mIRC Homepage
Posted By: LostShadow On ^*:Text: Detecting floods. - 09/08/07 12:24 AM
I'm trying to make a flood repeat check.

If someone did:

[timestamp] <Nick> Flood Flood Flood
[timestamp] <Nick> Flood Flood Flood
[timestamp] <Nick> Flood Flood Flood
[timestamp] <Nick> Flood Flood Flood
[timestamp] <Nick> Something else...

It would output as:

Nick said the word "Flood Flood Flood" x times in x seconds.
[timestamp] <Nick> Something else..

There are several reasons to do this: 1 is when people flood channels, it slows down my mIRC because of the on text events, so having an on ^*:text event may hopefully speed it up if it's halfdef the flood?

And then, less buffer text.

I already have these variables:

%thisnick$chan
%lastnick$chan
%thistext$chan
%lasttext$chan

In order to do this, I would need an on ^*:text event.

Of course, using an on ^*: will cause mIRC to use more events compared to a defaut plain mIRC, so the first thing is to check for $len($1-), where the large number is debatable.

Here's my untested code:

Code:
on ^*:text:*:#: {
  if ($len($1-) > 250) {
    if ($eval($+(%,lasttext.,$chan),2) == $eval($+(%,thistext.,$chan),2)) && ($eval($+(%,lastnick.,$chan),2) == $eval($+(%,thisnick.,$chan),2)) {
      /haltdef | inc %Repeat $+ $nick
    }
    if ($eval($+(%,lasttext.,$chan),2) != $eval($+(%,thistext.,$chan),2)) && ($eval($+(%,lastnick.,$chan),2) != $eval($+(%,thisnick.,$chan),2)) {
      /echo $chan $nick said " $+ $1- " $eval($+(%,Repeat,$nick),2) times in a row.
    }
  }
}


To test this though, I'd need to someone to repeat flood which ain't going to be arranged. Can you have on *:text: and on ^*:text: in the same page?
Posted By: CitizenKane Re: On ^*:Text: Detecting floods. - 09/08/07 02:53 AM
For a test, why not just copy the code into a test alias with some slight modification?

And for having both types of events (*, ^*), I don't think so.
Posted By: RusselB Re: On ^*:Text: Detecting floods. - 09/08/07 08:50 AM
For the two prefixes that you're considering, mIRC will not recognize the difference between them, so only the first one encountered will be used. The ^ character simply tells mIRC that the process will have a /halt statement in it.

This is different from using prefixes such as ! or @, which control the activation of the event depending on certain circumstances.

Posted By: Collective Re: On ^*:Text: Detecting floods. - 09/08/07 10:19 AM
Actually mIRC triggers the first matching ^-event in each Remote file before displaying the text and then triggers the non-^-events afterwards.

In other words you can have two matching on TEXT events trigger in the same file provided one is ^-prefixed and the other is not, and the ^-event will always fire first.
Posted By: LostShadow Re: On ^*:Text: Detecting floods. - 09/08/07 08:45 PM
Okay, that could be a problem. My on text stores the variables %thisnick$chan %lastnick$chan, etc., so that the on ^ text could use them as well. The way I understood it, mIRC reads the remotes from top to bottom, page 1 to page x, in that order. You're saying it finds all the ^ 1st top to bottom, then the non-^ top to bottom?

Well, if I move the on ^ to page 2, will mIRC read the on text in page 1 first?

Anyways, I tested you can't have on @*:join and on *:join in the same page in that order.

Thanks for the hints.

-Neal.
Posted By: RusselB Re: On ^*:Text: Detecting floods. - 09/08/07 10:33 PM
Sure you can. The first one would only be executed if you (ie: the client running the code) had full ops in the channel.

Only one of them would be used, but that would depend on whether the client had full ops in the channel or not.

If the client did, then the first one would be used, if not, then the second.
Posted By: LostShadow Re: On ^*:Text: Detecting floods. - 10/08/07 06:20 AM
Perfect, got my repeat detect script all fixed. Setted up my own clone and tested it out until perfect.

Code:
on ^*:text:*:#: {
  if ($eval($+(%,thistext.,$chan),2) == $1-) && ($eval($+(%,thisnick.,$chan),2) == $nick) {
    /haltdef | inc %Repeat $+ $nick
  }
  if (($eval($+(%,thistext.,$chan),2) != $1-) && ($eval($+(%,thisnick.,$chan),2) == $nick)) || ($eval($+(%,thisnick.,$chan),2) != $nick) {
    if ($eval($+(%,Repeat,$nick),2) > 1) {
      /echo $chan $nick said " $+ $eval($+(%,lasttext.,$chan),2) $+ " $eval($+(%,Repeat,$nick),2) times in a row. | /unset %Repeat $+ $nick
    }
  }
}
© mIRC Discussion Forums