mIRC Home    About    Download    Register    News    Help

Print Thread
#136594 30/11/05 06:04 PM
Joined: May 2005
Posts: 79
M
Babel fish
OP Offline
Babel fish
M
Joined: May 2005
Posts: 79
I found this while trolling the search feature on here

Code:
on *:text:*:#:{
  if (!%caps.floodprotection) {
    inc -u2 %caps.floodprotection
    var %caps = $regex($1-,/[A-Z]/g)
    if (%caps > 5) { msg $chan Stop talking in $round($calc(%caps / $len($1-) * 100),2) $+ % and stuff $nick }
  }
}  


Trouble is, if someone writes a decent size sentence that will have 5 caps or more randomly it gets triggered, how would i change it to trigger on say 5 or more caps in a row BLAHBLAH and not blaH blaH blaH blaH blaH

thanks.

#136595 30/11/05 06:46 PM
Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
The answer to your question is already in that script. The percent of caps that is included in the message can be used as the condition.
Code:
on *:text:*:#:{
  if (!%caps.floodprotection) {
    inc -u2 %caps.floodprotection
    if ($calc($regex($1-,/[A-Z]/g) / $len($1-) * 100) > [color:green]50[/color]) msg $chan Stop talking in $round($ifmatch,2) $+ % and stuff $nick 
  }
}


The green 50 can be altered to the desired level in percent.

-genius_at_work

#136596 30/11/05 08:38 PM
Joined: May 2005
Posts: 79
M
Babel fish
OP Offline
Babel fish
M
Joined: May 2005
Posts: 79
That doesn't seem to do what i want it to, it's not very accurate for a start, i tested the exact code i could do 1 cap, and it triggered it off

#136597 30/11/05 11:11 PM
Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
Ok, try this code then. It has a minimum limit for length.

Code:
on *:text:*:#:{
  if (%caps.floodprotection) return
  if ($len($1-) <= [color:red]5[/color]) return

  var %pcnt = $calc($regex($1-,/[A-Z]/g) / $len($1-) * 100)
  if (%pcnt <= [color:green]50[/color]) return

  set -u2 %caps.floodprotection
  msg $chan Stop talking in $round(%pcnt,2) $+ % and stuff $nick 
}


RED = ignore text that is less than or equal to 5 characters in length
GREEN = ignore text that has less than or equal to 50% uppercase characters.

-genius_at_work

#136598 01/12/05 01:17 PM
Joined: May 2005
Posts: 79
M
Babel fish
OP Offline
Babel fish
M
Joined: May 2005
Posts: 79
Yeah lovely, that did the job! smile

Just one small query with it though

<nick> THIS IS TALKING IN CAPS
<me> Stop talking in 81.82% caps and stuff nick

i'd regard that as 100% but i know it's taking spaces into account
how would i remove them?

#136599 01/12/05 04:36 PM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019


Gone.
#136600 01/12/05 05:15 PM
Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
Which characters do you want to be considered "caps" and "non-caps"? A-Z are uppercase, a-z are lowercase, 1-9!@#$%^&*()etc have no case. You need to decide which ones you want to unclude. The following code considers A-Z vs a-z... all other characters are ignored:

Code:
on *:text:*:#:{
  if (%caps.floodprotection) return
[color:red]  var %var,%temp = $regsub($1-,/[^A-Za-z]+/g,,%var)
  tokenize 32 %var[/color]
  if ($len($1-) &lt;= 5) return
...


Add the red parts to the previous code. The rest is identical.

-genius_at_work


Link Copied to Clipboard