mIRC Home    About    Download    Register    News    Help

Print Thread
Attribute abuse [control codes] #106231 26/12/04 10:12 PM
Joined: Dec 2003
Posts: 261
M
milosh Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Dec 2003
Posts: 261
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?


velicha dusha moja Gospoda
Re: Attribute abuse [control codes] #106232 26/12/04 11:50 PM
Joined: Mar 2004
Posts: 457
D
Danthemandoo Offline
Fjord artisan
Offline
Fjord artisan
D
Joined: Mar 2004
Posts: 457
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

Re: Attribute abuse [control codes] #106233 26/12/04 11:53 PM
Joined: Aug 2003
Posts: 1,831
I
Iori Offline
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
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 }

Re: Attribute abuse [control codes] #106234 26/12/04 11:56 PM
Joined: Dec 2003
Posts: 261
M
milosh Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Dec 2003
Posts: 261
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?

Last edited by milosh; 27/12/04 12:03 AM.

velicha dusha moja Gospoda
Re: Attribute abuse [control codes] #106235 27/12/04 12:18 AM
Joined: Aug 2003
Posts: 1,831
I
Iori Offline
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
^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

Re: Attribute abuse [control codes] #106236 27/12/04 12:28 AM
Joined: Dec 2003
Posts: 261
M
milosh Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Dec 2003
Posts: 261
Yeeeeees, I see now. So, that wasn't a big problem like I tought it is blush
Thanks a lot, both.


velicha dusha moja Gospoda
Re: Attribute abuse [control codes] #106237 27/12/04 09:34 PM
Joined: Jan 2003
Posts: 2,523
Q
qwerty Offline
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
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 }


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Re: Attribute abuse [control codes] #106238 27/12/04 10:06 PM
Joined: Aug 2003
Posts: 1,831
I
Iori Offline
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
Yeah, I gave that in PM already for the same reason laugh

Re: Attribute abuse [control codes] #106239 27/12/04 10:12 PM
Joined: Dec 2003
Posts: 261
M
milosh Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Dec 2003
Posts: 261
I tought you work together... shocked shocked shocked


velicha dusha moja Gospoda