mIRC Home    About    Download    Register    News    Help

Print Thread
Warnings. #242352
06/07/13 02:03 PM
06/07/13 02:03 PM
Joined: Jun 2013
Posts: 43
G
GamingTom Offline OP
Ameglian cow
GamingTom  Offline OP
Ameglian cow
G

Joined: Jun 2013
Posts: 43
Hi, I currently have this script which sends a message if 80% of someones message is caps. I would like them to have 2 chances or warnings and on the second it bans them from the channel. I can't figure out how to do this and I would really appreciate some help.
Many thanks, Tom.

Code:
ON @*:TEXT:*:#: {
  IF (($len($1-) < 9) || ($nick isop #)) { RETURN }
  VAR %text = $strip($remove($1-,$chr(32)))
  VAR %non.caps = $len($removecs(%text,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z))
  VAR %full.line = $len($strip($remove(%text,$chr(32))))
  VAR %percent = $calc(1 - (%non.caps / %full.line))
  IF (%percent >= 0.8) {
    msg $chan $nick $+ : Please use less caps, first warning.
  }
}


Last edited by GamingTom; 06/07/13 02:13 PM.
Re: Warnings. [Re: GamingTom] #242367
08/07/13 03:36 PM
08/07/13 03:36 PM
Joined: Oct 2012
Posts: 164
D
Deega Offline
Vogon poet
Deega  Offline
Vogon poet
D

Joined: Oct 2012
Posts: 164
Set/inc a variable each time the condition is met, if the variable reaches your cutoff point, ban/kick the user, else warn them.
Code:
ON @*:TEXT:*:#: {
  IF (($len($1-) < 9) || ($nick isop #)) { RETURN }
  var %a = $regex($1-,/[A-Z]/Sg) / $regex($1-,/[^ ]/Sg)
  if (%a >= 0.8) {
    inc -e $+(%,caps,$cid,#,.,$site)
    if ($($+(%,caps,$cid,#,.,$site),2) > 2) { ban -k1800 # $nick 2 Caps! $ord($v1) and out! | unset $+(%,caps,$cid,#,.,$site) }
    else msg $chan $nick $+ : Please use less caps, $ord($v1) warning.
  }
}

Re: Warnings. [Re: Deega] #242368
08/07/13 03:49 PM
08/07/13 03:49 PM
Joined: Jun 2013
Posts: 43
G
GamingTom Offline OP
Ameglian cow
GamingTom  Offline OP
Ameglian cow
G

Joined: Jun 2013
Posts: 43
Thanks for the reply, but I don't think I understand what is going on in the script, it would be great if you could maybe walk me though what you've changed.
Many thanks, Tom.

-- EDIT --
I have in fact figured it out and changed the 'ban' part of the script to work with Twitch and it seems to work perfectly now, thanks a lot for your help!

Last edited by GamingTom; 08/07/13 03:51 PM.