mIRC Homepage
Posted By: milosh Attribute abuse [control codes] - 26/12/04 10:12 PM
Hi, people. I have a problem that I can not solve becouse I don't understand it. Channel operators need a script that will kickban user that brake this rule (the problem is that I don't understand that rule):
Attribute abuse (colors in one line): control codes 40 characters - tempban 60sec
I tried to translate that rule to english the best I could.
Can anybody help me how to extract and count that control codes?
Posted By: Danthemandoo Re: Attribute abuse [control codes] - 26/12/04 11:50 PM
this is a basic, rather stupid way of doing it but i'm still full after boxing day meal cool

Code:
alias calc.color.codes { 
  var %size.before.strip $len($2-)
  var %size.after.strip $len($strip($2-,c))
  var %codes.before.kick $1 
  var %codes.used $calc($calc(%size.before.strip - %size.after.strip)/2)
  if (%codes.used > %codes.before.kick) { 
    echo -s kicked for using %codes.used
  }
}


usage:
/calc.color.codes <allowed color codes> text
EG:
/calc.color.codes 5 $1-

more of a tutorial than an actual script but after a huge meal i can't be bothered to script more, but you get the idea smile
Posted By: Iori Re: Attribute abuse [control codes] - 26/12/04 11:53 PM
Something like this maybe, it only counts the actual ^BURKO chars
Code:
on $@*:text:/[]/:#:if $regex($1-,/[[:cntrl:]]/g) &gt;= 40 { ban -ku60 # $nick 2 Attribute abuse: $v1 codes }
Posted By: milosh Re: Attribute abuse [control codes] - 26/12/04 11:56 PM
Thank you, Danthemandoo. And you think that there is a better way of doing what I need than your way? I will make that code as small as it can be, but do you think that the whole idea can be different?

Edit: Sorry, Iori I posted this before I have read your post :tongue: What are ^BURKO chars? Are they something more than colors?
Posted By: Iori Re: Attribute abuse [control codes] - 27/12/04 12:18 AM
^BURKO chars are the control chars for Bold Underline Reverse Kolor(sic) Off - same as $strip( ,burco). (^K is really a ^C) laugh
What the script doesn't do is count the ^K04,12 color number chars.
I phrased that wrongly, it counts all cntrl chars, but only triggers if a burko is present
Posted By: milosh Re: Attribute abuse [control codes] - 27/12/04 12:28 AM
Yeeeeees, I see now. So, that wasn't a big problem like I tought it is blush
Thanks a lot, both.
Posted By: qwerty Re: Attribute abuse [control codes] - 27/12/04 09:34 PM
An alternative that'll probably make it a bit faster, as it does a single regex match, is this:
Code:
on $@*:text:/([])/g:#:if $regml(0) &gt;= 40 { ban -ku60 # $nick 2 Attribute abuse: $v1 codes }
Posted By: Iori Re: Attribute abuse [control codes] - 27/12/04 10:06 PM
Yeah, I gave that in PM already for the same reason laugh
Posted By: milosh Re: Attribute abuse [control codes] - 27/12/04 10:12 PM
I tought you work together... shocked shocked shocked
© mIRC Discussion Forums