View Single Post
  #5   Spotlight this post!  
Unread 04-04-2003, 12:08
rbayer's Avatar Unsung FIRST Hero
rbayer rbayer is offline
Blood, Sweat, and Code
no team (Teamless Orphan)
 
Join Date: Mar 2002
Rookie Year: 2001
Location: Minnetonka, MN
Posts: 1,087
rbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of light
Send a message via AIM to rbayer
Unfortunately, the PBASIC tokenizer will not accept things like myVar=(p1_y>127), etc with the exception of predicates in IF statements. Ie, you can do IF myVar=(p1_y>127) THEN doStuff, but the = will be interpreted as equality, not assignment. Someone please correct me if I'm wrong on this...

As for the integer math, that only works assuming that bytevarX will never be bigger than the value you are testing for. If it could be, then the behavior is rather sporadic. For example. bitVarY=5/10 will assign the value 0 to bitVarY since the lowest-order bit of 5/10 (= 10b) is zero, wheras 5/15 (=11b) will assign it the value 1.


You can, however, express what you want on one line:

IF (bytevarX = 254) THEN bitvarY = 1 ELSE bitvarY = 0


--Rob
__________________
New C-based RoboEmu2 (code simulator) available at: http://www.robbayer.com/software.php