+Muddyfunster Posted March 21, 2020 Share Posted March 21, 2020 Hi all, I've run into a problem where I'm trying to add two scores together but do not seem able to get the code to work. I have an action that triggers "score0 = score0 + 1" and displays it. - all good I have a second action that triggers "score1 = score1 + 1" and displays it. - all good I want a third score to be the sum of score 0 and 1. My thinking was I could define "score2" per the documentation, like "dim score2 = var1 (noting it will use var 1, var2 and var3). I then tried to update it with "score2 = score 2 + score0 : score2 = score2 + score1" but all I get is zero even though score0 is ticking up on each event as expected. I also tried just adding score0 to score1 and still got nothing. is it not allowed to add score variables together? Quote Link to comment Share on other sites More sharing options...
RevEng Posted March 22, 2020 Share Posted March 22, 2020 Yeah, the score code only handles very specific operations. Adding scores together isn't one of them, and honestly I don't want to bog the language down with more 24 bit math. If you really need to do that, you can resort to some assembly... asm ; score2 = score 2 + score0 sed ; set decimal mode clc ; lowest 2 digits... lda score0+2 adc score2+2 sta score2+2 ; middle 2 digits... lda score0+1 adc score2+1 sta score2+1 ; highest 2 digits... lda score0 adc score2 sta score2 cld ; clear decimal mode end 2 Quote Link to comment Share on other sites More sharing options...
+Muddyfunster Posted March 22, 2020 Author Share Posted March 22, 2020 Thanks @RevEng ! 1 Quote Link to comment Share on other sites More sharing options...
RevEng Posted March 22, 2020 Share Posted March 22, 2020 You're welcome! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.