SReject commented on a Page, Curse Word Dialog  -  May 28, 2012

No offense, napa, but a few things could be improved:
1: For p2p, instead of "/msg me", I'd suggest using "/echo -a" or something of the such
2: Instead of looping through the "bad word" list you could speed it up with(I think):

; Escape the curse word list, so anything stored in it doesn't alter the way the regex works:
var %r = $regsubex(%Cwords,/(?!\x2E)([[:punct:]])/g,\ $+ \1)

; Replace "," with "|" (In regex the "|" means "or")
var %r = $replacex(%r,$chr(44),|)

; Make it so it only matches words; ignore color codes and be case insensitive:
var %r = /(?:^| )( $+ %r $+ )(?: |$)/iS

;Check the users string against the created regex:
if ($regex($1-,%r)) {

  ;ban the user:
  ban -ku300 # $nick 2 Don't curse.

  ; Echo that the user was banned for cusing:
  if (%log.p2p) {
    echo -a $nick Was Banned For Cursing In Room # Date/Time $time(mmm dd h:nn tt) Word said: $regml(1)
  }

  ; Log to window if need be:
  if (%log.win) {
    window @Curse_Word_Dialog 
    aline @Curse_Word_Dialog $nick Was Banned For Cursing In Room # Date/Time $time(mmm dd h:nn tt) Word said: $regml(1) 
  }
}
 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.