January 10, 201610 yr Fuck logic, amirite? Percentage is not doing what it's supposed to? I'm like 99% sure my calculation is right... T_T maybe i'm missing some super small stupid detail but wut.
January 10, 201610 yr Author Make sure you cast correctly distPerc = (double)((currentDist / startDistance) * 100); Still doesn't work :c Edited January 10, 201610 yr by Paradox68
January 10, 201610 yr distPerc = (double)((currentDist / startDistance) * 100); Still doesn't work :c I don't think you're fixing the problem there, distPerc = (((double)currentDist / (double)startDistance) * 100.0); and make sure disPerc is of type double too, I think that should work?
January 10, 201610 yr Author I don't think you're fixing the problem there, distPerc = (((double)currentDist / (double)startDistance) * 100.0); and make sure disPerc is of type double too, I think that should work? WTHHHHHH
January 10, 201610 yr You're updating distPerc once, and only once, at the top of your onLoop() method. This is the root of your problem. You need to update both of them in your onPaint() method. Edited January 10, 201610 yr by Final Calibur
January 10, 201610 yr Author You're updating distPerc once, and only once, at the top of your onLoop() method. This is the root of your problem. You need to update both of them in your onPaint() method. I had them in onPaint before, same problem. EDIT: I DON'T KNOW HOW but putting it back in onPaint fixed it! thanks so much guys! Edited January 10, 201610 yr by Paradox68
January 10, 201610 yr I had them in onPaint before, same problem. In the image that you posted, this is the issue. distPerc was never being updated after you start the script, however you are updating currentDist in your onPaint() method. This would lead to the Distance: display on your paint showing correctly, however the percentage display is stuck at the original calculated amount at the start of the script. As everyone else is saying, you also need to make sure you're casting at least one of the variables in your distPerc calculation to a double (either currentDist or startDist), so that it performs floating point multiplication. This is for accuracy purposes.
January 10, 201610 yr I had them in onPaint before, same problem. EDIT: I DON'T KNOW HOW but putting it back in onPaint fixed it! thanks so much guys! He just told you how
Create an account or sign in to comment