Paradox68 Posted January 10, 2016 Share Posted January 10, 2016 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. Quote Link to comment Share on other sites More sharing options...
Chicken Wing Posted January 10, 2016 Share Posted January 10, 2016 Make sure you cast correctly Quote Link to comment Share on other sites More sharing options...
Paradox68 Posted January 10, 2016 Author Share Posted January 10, 2016 (edited) Make sure you cast correctly distPerc = (double)((currentDist / startDistance) * 100); Still doesn't work :c Edited January 10, 2016 by Paradox68 Quote Link to comment Share on other sites More sharing options...
Chicken Wing Posted January 10, 2016 Share Posted January 10, 2016 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? Quote Link to comment Share on other sites More sharing options...
Flamezzz Posted January 10, 2016 Share Posted January 10, 2016 (double) currentDist Quote Link to comment Share on other sites More sharing options...
Paradox68 Posted January 10, 2016 Author Share Posted January 10, 2016 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 Quote Link to comment Share on other sites More sharing options...
Final Calibur Posted January 10, 2016 Share Posted January 10, 2016 (edited) 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, 2016 by Final Calibur 1 Quote Link to comment Share on other sites More sharing options...
Paradox68 Posted January 10, 2016 Author Share Posted January 10, 2016 (edited) 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, 2016 by Paradox68 1 Quote Link to comment Share on other sites More sharing options...
Final Calibur Posted January 10, 2016 Share Posted January 10, 2016 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. Quote Link to comment Share on other sites More sharing options...
Chicken Wing Posted January 10, 2016 Share Posted January 10, 2016 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 3 Quote Link to comment Share on other sites More sharing options...