abaudrand #1 Posted November 28, 2010 Hi, I'm trying to do a checktest to determine the movement of the missile of one player depending the position of the other player. I wrote that: if player1y-player0y<30 then var6{1}=0 else var6{1}=1 but it will not compile. I guess I got a kind of 'syntax error'. Do I need to broke the operation like: temp2=player1y-player0y if temp2<30 then var6{1}=0 else var6{1}=1 What do you think? Quote Share this post Link to post Share on other sites
+Random Terrain #2 Posted November 28, 2010 I don't try to do math in an if-then. I use a temporary variable like in your second example. Quote Share this post Link to post Share on other sites
abaudrand #3 Posted November 28, 2010 okay, I'll try tommorow. I hoped it could save a line of code... Thanks RT. I don't try to do math in an if-then. I use a temporary variable like in your second example. Quote Share this post Link to post Share on other sites
SeaGtGruff #4 Posted November 29, 2010 if player1y-player0y<30 then var6{1}=0 else var6{1}=1 I'm able to compile that line of code without an error, so I think there must be something else wrong with your program. What makes you think it's in that line? What does the error message say? Michael Quote Share this post Link to post Share on other sites
abaudrand #5 Posted November 29, 2010 When I try to do the maths inside the if-then statement, the compilation stops at this line: .L0784 ; if player1y - player0y < 30 then var6{1} = 0 else var6{1} = 1 LDA player1y CMP player0y .skipL0784 .condpart344 But when I broke into two part the code, it works fine: .L0784 ; temp2 = player1y - player0y LDA player1y SEC SBC player0y STA temp2 .L0785 ; if temp2 < 30 then var6{1} = 0 else var6{1} = 1 LDA temp2 CMP #30 BCS .skipL0785 .condpart344 LDA var6 AND #253 STA var6 jmp .skipelse10 .skipL0785 LDA var6 ORA #2 STA var6 .skipelse10 For the moment, I will keep it broken in two parts even I don't understand why it doesn't work Regards. Quote Share this post Link to post Share on other sites
+RevEng #6 Posted November 29, 2010 if player1y-player0y<30 then var6{1}=0 else var6{1}=1 I'm able to compile that line of code without an error, so I think there must be something else wrong with your program. What makes you think it's in that line? What does the error message say? Michael I think compiling it requires this build of bB. Quote Share this post Link to post Share on other sites
abaudrand #7 Posted November 30, 2010 :/ I don't know if I should use this build of bB as long as it's not an official upgrade... Since I've switched to SC, I got more free variables available and I could burn one or two for storing figures for mathematical operations. I must agree this new build could spare them and I also guess it could spare cycles... (mumbling) Quote Share this post Link to post Share on other sites