Caps kicker

By Saeed on Sep 27, 2007

Pretty simple code. I am currently experimenting the use of regex as I have just started learning. This snippet uses regex to monitor the precentage of capital letters used in bits of text. I hope this works for everyone.

  • Thanks goes to Olliegod for giving me the idea to use the percentage of caps.
#caps On  
on @*:TEXT:*:#:{ 
  var %n 2
  if ($nick isreg $chan) { 
    var %percentage 60
    if ($calc($regex($1-,/[A-Z]/g) / $len($1-) * 100) > %percentage) {
      if (%n < 3)  {
        inc $+(%,caps,.,$nick,.,$wildsite)
        var %i $($+(%,caps,.,$nick,.,$wildsite),2)
        if (%i < %n) { 
          msg $chan You are currently using too many captial letters. This is the $ord(%i) time that you have broken this rule. Please stop this conduct or immidiate action will be taken against you.
        } 
        if (%i = 3) { 
          ban -ku120 # $nick You are using $calc($regex($1-,/[A-Z]/g) / $len($1-) * 100) percent caps. You have been warned before, you will now be banned.
          unset $+(%caps,.,$nick,.,$wildsite)
        }
      }
    }
  }
}

on @*:ACTION:*:#:{ 
  var %n 2
  if ($nick isreg $chan) { 
    var %percentage 60
    if ($calc($regex($1-,/[A-Z]/g) / $len($1-) * 100) > %percentage) {
      if (%n < 3)  {
        inc $+(%,caps,.,$nick,.,$wildsite)
        var %i $($+(%,caps,.,$nick,.,$wildsite),2)
        if (%i < %n) { 
          msg $chan You are currently using too many captial letters. This is the $ord(%i) time that you have broken this rule. Please stop this conduct or immidiate action will be taken against you.
        } 
        if (%i = 3) { 
          ban -ku120 # $nick You are using $calc($regex($1-,/[A-Z]/g) / $len($1-) * 100) percent caps. You have been warned before, you will now be banned.
          unset $+(%caps,.,$nick,.,$wildsite)
        }
      }
    }
  }
}
#caps end

menu channel { 
 caps kicker $group(#caps).status:
 .On/off:$iif($group(#caps).status = off, enable #caps, disable #caps)
}

Comments

Sign in to comment.
Sick_Puppy   -  Oct 04, 2007

Could You Make a Punctuation One Next?
:D

 Respond  
token   -  Sep 28, 2007

perhaps use groups to disable/enable the script, good work

 Respond  
Saeed   -  Sep 28, 2007

I fixed it. Thanks. =) You can edit the percentage in the %percentage variable below the if ($nick isreg $chan)

 Respond  
Olliegod   -  Sep 28, 2007

It is quite easy for someone to use more than 5 capital letters in a message. Perhaps a better method would be to kick people who use a certain percentage of capital letters, for example: OMG JOIN #NEWBP0WNAGE NOW!!! That sentence has 20 out of 28 characters capitalised, which would be about 71% capital letters. The maximum could be set around 50%, or even better, inclue a method for the user to define the percentage.

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.