mIRC Home    About    Download    Register    News    Help

Print Thread
J
jimieo
jimieo
J
To be clear, I did NOT write this script. I just do not know who the original author is.

I have changed the script a little bit to use a one second timer before sending the timeout command and message. The reasoning for this is that sometimes the timeout command would show in my channel before the users offending message.

Now, for my dilemma. Let's say a user sends "The Quick Brown Fox Jumped Over The Very Very Very Very Very Lazy Dog Thing." This message would cause a timeout for the capital letters. In my opinion, it should not. Is there a way to have it rule out messages like that from a timeout?

Code:
on *:text:*:#:{
  if ($mod($nick)) { halt }
  if ( $len($1-) >= 10 ) {
    if ( $calc($regex($1-,/[A-Z]/g)) >= 14 ) {
      var %capsblock = $rand(1,3)
      if (%capsblock == 1) { 
        .timerTO 1 1 msg $chan .timeout $nick 1      
        .timerTOmsg 1 1 msg $chan /me $nick -> calm your caps! [warning]
      }
      if (%capsblock == 2) { 
        .timerTO 1 1 msg $chan .timeout $nick 1      
        .timerTOmsg 1 1 msg $chan /me $nick -> Ey! stop yelling! [warning]
      }
      if (%capsblock == 3) { 
        .timerTO 1 1 msg $chan .timeout $nick 1
        .timerTOmsg 1 1 msg $chan /me $nick -> stop typing in BIG LETTERS! [warning]
      }
    }
  }
}

S
Sakana
Sakana
S
That only checks if there are >= 14 capital letters in $1-, not really a good solution ;P

Code:
if ( $calc($regex($1-,/[A-Z]/g) / $regex($1-,/[A-Z]/gi))  > 0.7 ) {


that checks if more than 70% of the characters are in caps, but you also need an $len condition so people don't get banned for saying "A"




J
jimieo
jimieo
J
The only issue with that one is if someone says "YAY!!!!!!!" they will get timed out for crossing the 70% threshold. That's not really timeout worthy, at least to me.

Though, I suppose I could do something like...

Code:
 if (( $calc($regex($1-,/[A-Z]/g)) >= 14 ) && ($calc($regex($1-,/[A-Z]/g) / $regex($1-,/[A-Z]/gi))  > 0.7 )) {


Back to mIRC!

Last edited by jimieo; 09/01/15 07:11 AM.
Joined: Feb 2003
Posts: 2,737
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,737
Try some of these patterns.


/[^a-z0-9]{20,}/ too many CAPS or SYMBOLS in a row.
/((.)\2{14,}?)/i repeated character 15+ times.
/((.{2,}?)\2{4,}?)/i repeated 2+ characters 5+ times. eg, LOLOLOLOLOL or HAH HAH HAH HAH HAH
/(\S{4,})(?:.*\1){4,}?/i using same 4+ characters (words) 5+ times anywhere in sentence.


From a conversation the other day I had with another twitch.tv user in ##mIRC on Freenode.


Well. At least I won lunch.
Good philosophy, see good in bad, I like!
P
Panda
Panda
P
@Raccoon

I've found this cap filtering very interesting and useful but I've always found regex quite complicated. I've got some of the basics down but I'm still learning.

I was trying to implement the too many CAPS or SYMBOLS regex but I can't seem to make it trigger.

Code:
    if $regex($1-,/[^a-z0-9]{20,}/) {
      msg $chan [Warning] to $nick for too many symbols in a sentence
}

I'm obviously implementing the regex incorrectly, could you or someone please point out what I've done wrong?

Thanks

Joined: Feb 2003
Posts: 2,737
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,737
You cannot use { } symbols inside $regex().

On @*:TEXT:*:#: {
var %re = /[^a-z0-9]{20,}/
if ($regex($1-,%re)) { msg $chan [Warning] $nick ... }
var %re = /... etc next pattern/
}


Edit: Correction, you can wrap the pattern inside a (?:...) if it contains { }

$regex($1-,/(?:[^a-z0-9]{20,})/)

Last edited by Raccoon; 09/01/15 04:53 PM.

Well. At least I won lunch.
Good philosophy, see good in bad, I like!
B
Blood_Wolf89
Blood_Wolf89
B
Originally Posted By: Raccoon
Try some of these patterns.


/[^a-z0-9]{20,}/ too many CAPS or SYMBOLS in a row.
/((.)\2{14,}?)/i repeated character 15+ times.
/((.{2,}?)\2{4,}?)/i repeated 2+ characters 5+ times. eg, LOLOLOLOLOL or HAH HAH HAH HAH HAH
/(\S{4,})(?:.*\1){4,}?/i using same 4+ characters (words) 5+ times anywhere in sentence.


From a conversation the other day I had with another twitch.tv user in ##mIRC on Freenode.


How would I do an if statement with all of them?


Link Copied to Clipboard