mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jun 2006
Posts: 79
B
Babel fish
OP Offline
Babel fish
B
Joined: Jun 2006
Posts: 79
Code:
ctcp !@*:*:#: { if ($nick isreg #) { .signal -n d # $nick ctcp | halt } } 
on !@*:ctcpreply:*: { if ($nick isreg #) && ($me isop #) { .signal -n d # $nick ctcpreply | halt } } 
on ^!@*:text:*:#: { if ($nick isreg #) { .signal -n c # $nick $1- | halt } } 
on ^!@*:action:*:#: { if ($nick isreg #) { .signal -n c # $nick $1- | halt } } 
on ^!@*:notice:*:#: { if ($nick isreg #) { .signal -n c # $nick $1- | halt } } 
on *:signal:*: {
  if ($signal == c) { 
    if ($regex($3-,/[[:cntrl:]]/g) > 49) { .signal -n d $1-2 codes | halt } 
    if ($regex($3-,/[[:upper:]]/g) > 49) { .signal -n d $1-2 caps | halt } 
    if ($regex($3-,/\d/g) > 49) { .signal -n d $1-2 number | halt }
    if ($regex($3-,/[[:punct:]]/g) > 49) { .signal -n d $1-2 symbol | halt } 
    if ($regex($3-,/[ $chr(174) ]/g) > 49) { .signal -n d $1-2 ascii | halt } 
    if ($regex($3-,/[ $chr(160) ]/g) > 49) { .signal -n d $1-2 blur | halt } 
    if ($regex($3-,/./g) > 199) { .signal -n d $1-2 lenght | halt }
    if ($regex($3-,/(#|http://|www.|.com|.net|.org)/i)) { .signal -n d $1-2 advertise | halt }
    if ($regex($3-,/\b(fck|btch)\b/i)) { .signal -n d $1-2 swear | halt }
    .hinc -u5m e $+($1,$2) 1 
    if ($hget(e,$+($1,$2)) > 4) { .signal -n d $1-2 lines | halt }
    var %f = $+($2,@,$1,@,$hash($remove($3-,$chr(160),$chr(32)),32))
    hinc -u5m e %f 1 
    if ($hget(e,%f) > 2) { .signal -n d $1-2 repeat | halt }
  }
  if ($signal == d) { 
    if ($2 ison $1) { 
      .hinc -u25m e g  
      if ($hget(e,g) < 20) { !kick $1 $2 $3 }
      .hadd -u10m h $+($2,*@*fake*)
      .timer_ 1 3 !mode $chan $1 $+(+,$str(b,$hget(h,*).item)) $hget(h,1).item $hget(h,2).item $hget(h,3).item $hget(h,4).item $hget(h,5).item $hget(h,6).item $hget(h,7).item $hget(h,8).item $hget(h,9).item $hget(h,10).item $hget(h,11).item $hget(h,12).item 
    }
  } 
}


Could anyone help me to improve this codes. Turn this codes into good regex parser maybe .. Use other better comparison maybe .. Or shorten the codes that bocome faster .. Thanks ..

Last edited by BanJirian; 06/10/07 05:22 AM.
Joined: Dec 2002
Posts: 503
B
Fjord artisan
Offline
Fjord artisan
B
Joined: Dec 2002
Posts: 503
Start by learning how to use if/elseif/else structure, and don't 'halt' everything.

Also note that the $chr(174) and $chr(160) lines are including a 'space' in the subset, so using $+, or pre-defining the pattern in a %variable is advisable.

As all the regular expressions are for unique reasons, I can't think of a way to neaten up/combine them more than the control structures used.


Link Copied to Clipboard