Quote:
Originally posted by Cheese Head
if ~(p1_y > 127 & p2_y > 127) then next2
Is there anything wrong with that?
|
Yes, there are a few mistakes in this expression form what i assume you are trying to accomplish. You are forgetting the order of opperations in P-BASIC. That is expressions are evaluated Left to right inside of each level of parentheses. So in your expression, this is what is really evaluated: ~(((p1_y>127) & p2_y) > 127) which is not what you are looking for. Also, you will never get a 0 value, you will always have a value > 0 because of the leading 1's (see my post above for the explanation). So the if statement will always evaluate true.
The easiest way to fix that is to sue NOT instead of ~ in the middle of the if statement. This will not work for stand alone calculations. Another option is to subtract out the 65534 after the ~ operation.
Steve