sting251 wrote:
How would I do the get key if I want it to have to have a series of numbers entered before it resets?
And is there a way to only be able to type in the code after a certain amount of time?

All of this is possible, though a little complicated. The getKey command returns a number corresponding to the latest keypress on the keypad. For instance, if getKey is used while ENTER is pressed, a 105 will be returned, and if 7 is pressed, a 72 will be returned. Here's a handy chart for the getKey codes:

So, while Input cannot run alongside an event loop, a getKey and some ingenuity can. The following code snippet will store input from getKey (provided it was a number) into an accurate numerical value in N. When combined with the previous code, we can produce a multi-digit number inputter alongside a running timer.

Code:
getKey->K
toString(K->Str1
(inString("102 92  93  94  82  83  84  72  73  74",Str1)-1)/4->N

Now that snippet can be integrated into the previous code. The following code will visibly count down a timer (currently set at 500 seconds), while at the same time accepting user input (from the number keys) and displaying that on the screen. Pressing enter or time ending will display win/loss results. The only way to win is to press enter before the time runs out, and have the inputted number be identical to a 10 digit max number stored in L2. Put the number in L2 before the program starts. For instance, if you want the required number to be 276475, store {0,0,0,0,2,7,6,4,7,5} to L2. I have not yet implemented only accepting input after a certain time.

Code:
ClrHome
Output(2,1,"Press ENTER
Output(1,3,":
DelVar A
Delvar B
10->dim(L1
Fill(0,L1
startTmr->T
Repeat not(E) or A or K=105   //checks if enter is pressed or time is up
   500-checkTmr(T->E   //sets the timer to count down from 500 seconds
   Output(1,1,iPart(E/60
   Output(1,4,remainder(E,60
   getKey->K
   toString(K->Str1
   (inString("102 92  93  94  82  83  84  72  73  74",Str1)-1)/4->N
   If N>-1
      N->L1(10-B   //stores inputted number to the proper place value in L1
   B+1->B  //advances place value
   Output(5,10-B,N  //displays inputted number in correct place value
End
If E and L1=L2  //if time is not up and number is correct
Then
   Output(3,1,"You WIN!"
Else
   Output(3,1,"You LOSE!"
End
Pause
If you look closely at the getkey chart, you will notice that it is simply ROWcolumn, where 'ROW' is the row (with the keys on the top layer being one), and 'column' being the column number, with 1 being on the far left and 5 being on the far right. The arrow keys are a little haphazardly named (in my opinion), but memorizing 4 keys is better than memorizing ~50 keys!

EDIT: getkey always returns a number, if there is no key, then it returns 0.
_iPhoenix_ wrote:
If you look closely at the getkey chart, you will notice that it is simply ROWcolumn, where 'ROW' is the row (with the keys on the top layer being one), and 'column' being the column number, with 1 being on the far left and 5 being on the far right. The arrow keys are a little haphazardly named (in my opinion), but memorizing 4 keys is better than memorizing ~50 keys!

EDIT: getkey always returns a number, if there is no key, then it returns 0.

The arrow keys match the ROWcolumn convention... Its just that they dont fall on exact rows so they had to make do with that. Where they are weird is in the getCSC codes, where they are 1,2,3,4 Wink
I noticed the topic title change. The final answer is that the TI-84 Plus CE, being a single-core computer, can only run one process at once. However, simultaneous processes can be synthesized using smart coding.
In response to your previous post asking for me to elaborate, I swear I could have seen a page on TI-BASIC dev that said that other commands could be run while another command was running, which I remember being the seq( command. (IIRC)

I think it was either for a different calculator, or wishful hoping by the author.

Here, have some optimizations:

Code:
ClrHome
Output(2,1,"Press ENTER
Output(1,3,":
DelVar ADelVar B //DelVar commands do not need a newline
10->dim(L1
Fill(0,L1
startTmr->T
Repeat not(E) or A or K=105   //checks if enter is pressed or time is up
   500-checkTmr(T->E   //sets the timer to count down from 500 seconds
   Output(1,1,iPart(E/60
   Output(1,4,remainder(E,60
   getKey->K
   toString(K->Str1
   (inString("102 92  93  94  82  83  84  72  73  74",Str1)-1)/4->N
   If N>0
      N->|L1(10-B   //stores inputted number to the proper place value in L1
   B+1->B  //advances place value
   Output(5,10-B,N  //displays inputted number in correct place value
End
If E and |L1=|L2  //if time is not up and number is correct
Then
   Output(3,1,"You WIN!
Else
   Output(3,1,"You LOSE!
End
Pause
  
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
Page 2 of 2
» All times are UTC - 5 Hours
 
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

 

Advertisement