Winner:
Name: cold-
File size: 214 bytes
How he did it:
First, he set one local variable with all 26 letters seperated by commas
var %. ,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
As you can see he knew the = wasn't needed in the var. He then set another var that counted the total of nonletters
%; $len($remove($1- [ %. ] ))
By removing all 26 letters from the message, then using $len, he now has %; that holds the total number of nonletters
Now in the third var he take the total number of characters and subtracts the total number of nonletters.
%: $len($1-) - %;
Now that he has the total number of letters and the total number of nonletters he uses an if statement before kicking
if $calc(100*($len($removecs($1- [ %. ] ))-%;)/%:) > 50 && %: > 9 kick # $nick too much caps: $ifmatch $+ %
In the first comparison using $calc() he checks if the percentage of caps is > 50 and in the second he simply checks if total letters > 9
The most important part of this code is what's inside $calc(), I'll spread it out to better explain it:
- First, the '100' is to switch the decimal to a percentage number.
- Then with $removecs() he removed all lowercase letters from the text string and used $len to get the length. Now he has total number of characters except lowercase.
- He then subtracted it the length of nonletters giving him the total number of caps.
- From there he just divided it by the number of letters giving him the percentage of caps...
100 * (<length of caps and nonletters> - <length of nonletters>) / <length of total letters>
And lastly he used $ifmatch, inside the kick message, which holds the percentage number within the if statement.
|