mIRC Homepage
Posted By: GamingTom Warnings. - 06/07/13 02:03 PM
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.
  }
}

Posted By: Deega Re: Warnings. - 08/07/13 03:36 PM
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.
  }
}
Posted By: GamingTom Re: Warnings. - 08/07/13 03:49 PM
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!
© mIRC Discussion Forums