What i have here is a script to locate charitors in a line and let me know when there is a problem.

I am trying to identify charitors in a var line to see if they have the right amount of ='s verses the right amount of , in the line.
here are the two lines I am testing the script with
I can get it to work with var %t = 0
if I expand the var line to more var's. Then the script will not locate the correct information.

var %c = $line(@win,0) , %q = $gettok(%data,1,9)
[color:black]or

var %t = 1, %p = 0, %b = 0, %e = 0
[/color]

Code:
  [color:red] 
alias test {
  var %line = $1- , %i = 1
  while %i <= $numtok(%line,32) {
    var %word = $gettok(%line,%i,32)
    if (($chr(37) == $left(%word,1)) && (%equ != 1)) { set %per 1 }
    if (($chr(61) == %word) && (%per == 1)) { set %equ 1 }
    if (($chr(61) != %word) && (%per == 1)) { set %per 0 }
    if ((1 == %per) && (1 == %equ)) { 
      //echo -a error 1
      set %per 0
    }
    if ($chr(44) isin $right(%t.word,1)) { set %per 0 }
    inc %i 1
  }
}
 [/color]