the bug, in this case, is due to the usage of the % character, which, to my knowledge, is only used to start a variable name, or to return the remainder from a division calculation.
If this is so (or even if it's not), just what were you expecting the % sign to do as part of a comparator?
In your second example
var -s %a 1, %b $iif(1 !%a 1,1,0)
which, substituting the value being assigned to %a (from the first part of the code) into the appropriate location in the second part, gives you
Since when is !1 (or not 1) a valid comparator between two different items (it's fine if being used as a full comparison in and of itself.)