View Single Post
  #7   Spotlight this post!  
Unread 30-11-2002, 16:19
Steve Shade Steve Shade is online now
Registered User
no team
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1999
Location: Pasadena, MD
Posts: 78
Steve Shade has much to be proud ofSteve Shade has much to be proud ofSteve Shade has much to be proud ofSteve Shade has much to be proud ofSteve Shade has much to be proud ofSteve Shade has much to be proud ofSteve Shade has much to be proud ofSteve Shade has much to be proud ofSteve Shade has much to be proud of
Re: Thanks everyone!

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