mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Aug 2014
Posts: 42
K
Ameglian cow
OP Offline
Ameglian cow
K
Joined: Aug 2014
Posts: 42
Hey guys,
i need a script that counts my bot messages, when my bot (himself) writes OVER 15 messages in 20 seconds a variable "%test" turn ON but after 5 seconds the variable turns off again.

Important is that the bot checks the whole times the amount of his own messages.

I have no idea how to do that laugh

Joined: Sep 2014
Posts: 259
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Sep 2014
Posts: 259
I wrote this. You need to run the alias after/before every instance of " msg # " you have. As far as I can tell, there's no ON Event for something like that, but I could be wrong

Code:
alias LineCount {
  if (!%LineCount) { set %LineCount 0 }
  if (!%LineTimer) { set %LineTimer $uptime }
  inc %LineCount
  echo -a %LineCount lines in $calc($uptime - %LineTimer) seconds

  if ($calc($uptime - %LineTimer) < 20 ) && (%LineCount > 15) {
    echo -a Limit reached
    ;do something here
    unset %Line* 

  }

  elseif ($calc($uptime - %LineTimer) > 20 ) && (%LineCount < 15) {
    echo -a Limit not reached, resetting counter
    set %LineCount 1 
    set %LineTimer $uptime
  }
}


edit: made code less unnecessarily complicated

Last edited by Sakana; 07/01/15 05:49 AM.
Joined: Aug 2014
Posts: 42
K
Ameglian cow
OP Offline
Ameglian cow
K
Joined: Aug 2014
Posts: 42

First of all THANK YOU for the effort!!

Its not working correctly i guess - i got this as feedback after a few messages:

"13 lines in 114 seconds"

What i want to do exactly:
I dont want that my bot writes more then 15 messages in 20 seconds - that will prevent him from get banned @ the network, ofc i have anti spam commands in the scripts but there are a few ways with many fake accounts to execute many commands (for example 30 accounts will spam a domain, my bot timeouts everyone of them = network ban because every command = a message!).

If 15+ messages sended in 20 seconds the bot turns the variable "%LineLimit" = on. If the variable %LineLimit = on, every script will return. (if (%linelimit == on) { return }) - after 8 seconds the bot has to turn the variable to off! (or $null)

Last edited by Krawalli; 08/01/15 02:45 PM.
Joined: Sep 2014
Posts: 259
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Sep 2014
Posts: 259
Hmm, try with this extra if statement. It works correctly for me when I spam /linecount with different speeds. And, yeah, just use if (%LineLimit == on) return

Code:
alias LineCount {
  if (!%LineCount) { set %LineCount 0 }
  if (!%LineTimer) { set %LineTimer $uptime }
  inc %LineCount
  echo -a %LineCount lines in $calc($uptime - %LineTimer) seconds

  if ($calc($uptime - %LineTimer) < 20 ) && (%LineCount >= 15) {
    echo -a Limit reached
    unset %Line* 
    set %LineLimit On
    .timer 1 8 set %LineLimit Off
  }

  elseif ($calc($uptime - %LineTimer) > 20 ) && (%LineCount < 15) {
    echo -a Limit not reached, resetting counter
    set %LineCount 1 
    set %LineTimer $uptime

  }

  elseif ($calc($uptime - %LineTimer) > 20 ) && (%LineCount >= 15) {
    echo -a Limit not reached, resetting counter
    set %LineCount 1 
    set %LineTimer $uptime

  }

}




Last edited by Sakana; 08/01/15 04:13 PM.
Joined: Aug 2014
Posts: 42
K
Ameglian cow
OP Offline
Ameglian cow
K
Joined: Aug 2014
Posts: 42
Okay that is working pretty fine, thanks a lot!

Last edited by Krawalli; 08/01/15 06:40 PM.

Link Copied to Clipboard