abaudrand #1 Posted July 22, 2010 Hi, I'm trying to spare variables and started to rewrite my program by using a{0}, a{1}, etc... as most of them are TRUE/FALSE tag. It worked fine when all variables were a,b,f,i etc... but now, I've just changed them, the compilation go wrong... I've spent the last two night to scratch my head but can't see whats wrong... Quote Share this post Link to post Share on other sites
+Random Terrain #2 Posted July 22, 2010 I have to go out for a few hours. If nobody looks at it by then, I'll see if I can track down the problem when I get back. Quote Share this post Link to post Share on other sites
SeaGtGruff #3 Posted July 22, 2010 You can't check the value of a bit variable this way: if a{3} = 1 then missile1y=missile1y+1 Instead, you have to do it this way: if a{3} then missile1y=missile1y+1 That's to see if the bit is 1, or turned on (a "true" value). To see if the bit is 0, or turned off (a "false" value), use the ! or "not" operator, like this: rem * old line rem if a{1}=1 && a{2}=0 then missile0x=missile0x+d:missile0y=missile0y+e:goto DoneFire rem * corrected line if a{1} && !a{2} then missile0x=missile0x+d:missile0y=missile0y+e:goto DoneFire Michael Quote Share this post Link to post Share on other sites
+Gemintronic #4 Posted July 22, 2010 (edited) SeaGtGruff to the rescue! My eyeballs were hurting looking for the syntax error. I didn't even know about that caveat with binary values. I take it if a{1} = %1 then gosub way_sandwhich wont work? Edited July 22, 2010 by theloon Quote Share this post Link to post Share on other sites
SeaGtGruff #5 Posted July 22, 2010 SeaGtGruff to the rescue! My eyeballs were hurting looking for the syntax error. I didn't even know about that caveat with binary values. I take it if a{1} = %1 then gosub way_sandwhich wont work? Correct; it would have to be if a{1} then gosub way_sandwhich Michael Quote Share this post Link to post Share on other sites
abaudrand #6 Posted July 23, 2010 Thanks for the lesson of basic, guys! I will rewrite my program later with that in mind! Quote Share this post Link to post Share on other sites
+Random Terrain #7 Posted July 23, 2010 SeaGtGruff to the rescue! My eyeballs were hurting looking for the syntax error. I didn't even know about that caveat with binary values. I take it if a{1} = %1 then gosub way_sandwhich wont work? Yeah, the bB page says: http://www.randomterrain.com/atari-2600-memories-batari-basic-commands.html#bit Notice that bit operations do not use an equal sign in if-then statements. Maybe it also needs a Warning message or a Did You Know? message. Quote Share this post Link to post Share on other sites
+Random Terrain #8 Posted July 23, 2010 I went with a Did You Know? box: http://www.randomterrain.com/atari-2600-memories-batari-basic-commands.html#bit See if that's OK. Quote Share this post Link to post Share on other sites
abaudrand #9 Posted July 23, 2010 thanks Random Terrain for "the did you know?". It's more clear for newbies like me Quote Share this post Link to post Share on other sites