mIRC Home    About    Download    Register    News    Help

Print Thread
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
Joined: Mar 2004
Posts: 457
D
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

Joined: Aug 2003
Posts: 1,831
I
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 }

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
Joined: Aug 2003
Posts: 1,831
I
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

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
Joined: Jan 2003
Posts: 2,523
Q
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
Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
Yeah, I gave that in PM already for the same reason laugh

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

Link Copied to Clipboard