Join us on Discord!
You can help CodeWalrus stay online by donating here.

Timer in Nspire Lua

Started by semiprocoder, December 24, 2015, 04:35:57 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

semiprocoder

Recently, for cookie clicker and my idea for the contest(which I am still not sure about(it is basically going to be a don't touch the spikes remake if I decide on it)), I have been using something along these lines(this is for the game I am working on currently, and vel, coords, and accel are vectors):
edit: nvm, can't release code for contest
and similarly for cookie clicker:

  self.output*self.amt*(millis()-prevTime)/1000


I have for a while known that my cookie clicker game never gives the full income per second. I didn't think it was too much, as, even at optimal 30 fps, it would have an innacuracy of (3.3-3)/3.3, which is about only 10%, which, while being annoying, isn't too ridiculous.

However, over the time I have played my cookie clicker, I have noticed that the actual error is bigger than just 10%. Furthermore, a few minutes ago I looked at the documentation again to try to find something better than milliseconds, and noticed that even timer.getMilliSecCounter() doesn't even return the milliseconds with accuracy to a millisecond. It returns only with an accuracy of 0.02, which makes more sense with the numbers I get with cookie clicker.

Thus, the question I ask is this:
1. Are there any better ways to get time in lua?
2. What are some alternatives to using time to calculate the multiplier for accel/velocity?[/code]
  • Calculators owned: ti nspire, ti 84 plus se
My cemetech username is awesommee333.

Powered by EzPortal