Don't have an account? Register now to chat, post, use our tools, and much more.
Latest Headlines
Online Users
There are 108 users online: 5 members, 76 guests and 27 bots. Members: legodude, Ratchetx7. Bots: Spinn3r (1), MSN/Bing (1), Magpie Crawler (3), VoilaBot (1), Googlebot (20), MSN/Bing (1).
RSS & Social Media
SAX
You must log in to view the SAX chat widget
|
| Author |
Message |
|
kpa4941

New Member

Joined: 23 Nov 2010 Posts: 84 Location: Carrollton, Texas
|
Posted: 18 May 2011 10:16:43 pm Post subject: Calculator Timer |
|
|
I am currently developing a game on my calculator but the way that the game calculates time isn't accurate all of the time. It adds ten to the current system time that I retrieve by using chktimer to make a countdown for the user to push the enter button as fast as they can.
It then gives the user between 10-9 seconds instead of an actual 10 seconds of time, which really bothers me because the high scores won't be accurate if one user might get 9.9 seconds while the other one gets 9.1. Is it possible for the calculator to give the user exactly 10 seconds?
Thanks in advance. _________________ --kpa4941 |
|
| Back to top |
|
|
JosJuice

Power User

Joined: 17 Oct 2010 Posts: 306 Location: Sweden
|
Posted: 19 May 2011 08:29:11 am Post subject: |
|
|
| The RTC clock on the 84+ will only report seconds, not fractions of seconds. |
|
| Back to top |
|
|
harold
Drama Queen

Joined: 01 May 2011 Posts: 48
|
Posted: 19 May 2011 08:42:25 am Post subject: |
|
|
You could first wait until the "Seconds" part of the time changes, and count 10 seconds from then, that would introduce up to a second of delay but it should be fairly accurate.
If you can use ASM subroutines, you could try using the crystal timer. |
|
| Back to top |
|
|
Compynerd255

Power User

Joined: 08 Apr 2011 Posts: 397
|
Posted: 19 May 2011 11:06:14 am Post subject: |
|
|
How do you even use the clock at all? I tried to use it once on my friend's 84 Plus, but I couldn't figure out any of it.
If it doesn't report fractions of seconds, then, yes, waiting for a Seconds change is a good idea. _________________ Visit Betafreak Games: http://www.betafreak.com
Help Me Pay for College:
- Sign up for Fastweb through my referal link! |
|
| Back to top |
|
|
JosJuice

Power User

Joined: 17 Oct 2010 Posts: 306 Location: Sweden
|
Posted: 19 May 2011 11:10:49 am Post subject: |
|
|
| Compynerd255 wrote: | | How do you even use the clock at all? I tried to use it once on my friend's 84 Plus, but I couldn't figure out any of it. | The command getTime can be used to get a three-element list of current hour, minute and second. There's also getDate for dates, and a few functions that return strings. |
|
| Back to top |
|
|
KermMartian

Site Admin

Joined: 14 Mar 2005 Posts: 55770 Location: Earth, Sol, Milky Way
|
Posted: 19 May 2011 01:24:52 pm Post subject: |
|
|
As harold suggested, you can wait in a tight loop for the seconds to change, then start the game there. Kpa, you should be sure to start a Your Projects topic about this! _________________
 |
|
| Back to top |
|
|
kpa4941

New Member

Joined: 23 Nov 2010 Posts: 84 Location: Carrollton, Texas
|
Posted: 19 May 2011 04:12:51 pm Post subject: |
|
|
I will most likely start a thread of my game in the Your Projects section soon, but I still don't really get this "tight loop". Would I run loop that continuously checks the time and once the seconds changes it would proceed with the program? _________________ --kpa4941 |
|
| Back to top |
|
|
_player1537

Guru-in-Training

Joined: 25 Nov 2009 Posts: 2958
|
|
| Back to top |
|
|
kpa4941

New Member

Joined: 23 Nov 2010 Posts: 84 Location: Carrollton, Texas
|
Posted: 22 May 2011 07:03:57 pm Post subject: |
|
|
Thank you for your code. I added it to my program and the countdown timer gives everyone an equal and fair time limit now. _________________ --kpa4941 |
|
| Back to top |
|
|
KermMartian

Site Admin

Joined: 14 Mar 2005 Posts: 55770 Location: Earth, Sol, Milky Way
|
Posted: 23 May 2011 01:39:48 pm Post subject: |
|
|
| kpa4941 wrote: | | Thank you for your code. I added it to my program and the countdown timer gives everyone an equal and fair time limit now. | Excellent, that's great to hear. Another success for Cemetech's TI-BASIC coders.  _________________
 |
|
| Back to top |
|
|
DJ_O

Retired TI-83+ coder

Joined: 18 Mar 2005 Posts: 1487 Location: Quebec (Canada)
|
Posted: 23 May 2011 04:03:55 pm Post subject: |
|
|
As a small note, not that I discourage using the clock completely when it's necessary, but whenever possible, I recommend creating your own clock, even if it's not accurate, so that your game will run on the TI-83 Plus and TI-83 Plus Silver Edition calculators, which still got a large userbase. This is what I did in Illusiat 7, back in 2002 (although back then this was not the reason why, as the TI-84 Plus did not even exist, back then) _________________ Retired 83+ coder, Omnimaga/TIMGUL founder. Now doing power metal music (formerly did electronica)
Follow me on Bandcamp|Facebook|Reverbnation|Youtube|Twitter |
|
| Back to top |
|
|
KermMartian

Site Admin

Joined: 14 Mar 2005 Posts: 55770 Location: Earth, Sol, Milky Way
|
Posted: 23 May 2011 11:33:25 pm Post subject: |
|
|
Indeed, but the problem with the non-crystal calculators is that their CPU speed changes with the power level of the batteries. You can more or less approximate it with some careful loop counting, though, so that's a good suggestion. _________________
 |
|
| Back to top |
|
|
|
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.
» Go to Registration page
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
© Copyright 2000-2013 Cemetech & Kerm Martian :: Page Execution Time: 0.034618 seconds.
|