There's no boolean operation but AND
Finally tracked down a bothersome bug in my script interpreter. It was in the evaluation of boolean expressions, in this snippet:
if(operation==5) //AND
res.iVal=((v1.iVal!=0) && (v2.iVal!=0)?1:0);
else if(operation==5) //OR
res.iVal=((v1.iVal!=0) || (v2.iVal!=0)?1:0);
It's tricky to spot (which is how I got it wrong the first time) but notice how both the if and the else if check if the operation is 5, logical AND? The second one should be 6 for OR. As it was, OR statements were simply never evaluated, and the result returned was whatever had been lying around in memory. Ouch. At least it's fixed now.