First thing. You can\'t kick someone who\'s talking to you in a query. You can do this however:
if ($chan) { kick $v1 $nick blah blah }
else { close -m $nick }
Also, the above would work, but you can use this for shorter code too:
on :TEXT::#: {
var %x = 1,%y
while (%x <= $len($1-)) {
if ($right($left($1-,%x),1) isupper) inc %y
inc %x
}
if (%y > $calc($len($1-) * .5)) { do action... }
}