mIRC Home    About    Download    Register    News    Help

Print Thread
On ^*:Text: Detecting floods. #182409 09/08/07 12:24 AM
Joined: Jan 2004
Posts: 509
L
LostShadow Offline OP
Fjord artisan
OP Offline
Fjord artisan
L
Joined: Jan 2004
Posts: 509
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?

Re: On ^*:Text: Detecting floods. [Re: LostShadow] #182414 09/08/07 02:53 AM
Joined: Mar 2006
Posts: 47
C
CitizenKane Offline
Ameglian cow
Offline
Ameglian cow
C
Joined: Mar 2006
Posts: 47
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.

Re: On ^*:Text: Detecting floods. [Re: LostShadow] #182416 09/08/07 08:50 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
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.


Re: On ^*:Text: Detecting floods. [Re: RusselB] #182420 09/08/07 10:19 AM
Joined: Dec 2002
Posts: 3,138
C
Collective Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
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.

Re: On ^*:Text: Detecting floods. [Re: Collective] #182455 09/08/07 08:45 PM
Joined: Jan 2004
Posts: 509
L
LostShadow Offline OP
Fjord artisan
OP Offline
Fjord artisan
L
Joined: Jan 2004
Posts: 509
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.

Re: On ^*:Text: Detecting floods. [Re: LostShadow] #182465 09/08/07 10:33 PM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
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.

Re: On ^*:Text: Detecting floods. [Re: RusselB] #182490 10/08/07 06:20 AM
Joined: Jan 2004
Posts: 509
L
LostShadow Offline OP
Fjord artisan
OP Offline
Fjord artisan
L
Joined: Jan 2004
Posts: 509
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
    }
  }
}