mIRC Homepage

Is it possible to ..

Posted By: woof

Is it possible to .. - 15/12/07 12:10 PM

Make a script so it kicks people if they over use CAPS.

Like this

meow: This is well COOL! (Wouldn't kick)

}

meow: THIS IS WELL COOL! (Would kick)


After one sentence with 3 or more words in CAPS it kicks them.. Is this possible to do? And has anyone done it? i'm wondering how.
Posted By: TropNul

Re: Is it possible to .. - 15/12/07 03:35 PM

With
Code:
On $@*:Text:/(?:[[:upper:]]{2,}\b\s?){3,}/S:#channel:KICK # $nick CAPS abuse detected!

Or with
Code:
On @*:Text:*:#channel:{
  If ($regex($1-,/[[:upper:]]{1,}\b\s?/Sg) > 2) {
    KICK # $nick CAPS abuse detected!
  }
}

the desired action shall function.

Otherwise, there are methods with counts the total number of caps characters, then calculates a percentage. And for example, if it's bigger than 80%, sanction!

Code:
On @*:Text:*:#channel:{
  Var %d = $strip($1-) , %l = $len(%d)
  If ($calc($regex(%d,/[[:upper:]]/g) / %l) > 0.8) {
    KICK # $nick CAPS abuse detected!
  }
}


There may be for sure other (even better) methods out there. smile These are just examples.

Cordialement

nb: untested!
Posted By: Lpfix5

Re: Is it possible to .. - 15/12/07 05:00 PM

Theres also the $isupper command over regex

on @*:TEXT:*:#:{
if ($isupper($1-) == $true) { kick # $nick UPPERCASE Detected! }
}

Posted By: Horstl

Re: Is it possible to .. - 15/12/07 05:21 PM

Your first reg /(?:[[:upper:]]{2,}\b\s?){3,}/S works only for 3 (ore more) successive upper case words (of 2 or more letters), e.g. catching: SEE YA ALL, not catching: SEE YA @ALL, not catching: SEE - YA - ALL

I wish I could improve such regex method, but I cannot smile ... thus used more plain methods so far, like:
Code:
; calculate caps and caps percent (only upper letters count to caps)
  var %t = $remove($strip($1-),$chr(32),!,?), %l = $len(%t), %c = $regex(%t,/[A-Z]/g), %p = $round($calc(%c / %l *  100),0)
  ; caps by regular user; and at least 70% of text
  if (($nick isreg $chan) && (%p > 70)) {
    ; at least 10 letters and 3 words; or 40 letters
    if (((%l > 10) && ($numtok($1-,32) >= 3)) || (%l > 40)) {
© 2022 mIRC Discussion Forums