On the ti 84 plus ce, is there a way in ti basic for two things in a code to happen simultaneously while one is an input, and one is a if then check

I'm making a timer, and want go find a way for if to count down and I've a button isn't pressed by the time the timer runs out, you lose.

Also, I want to know if I can have an Output( and Input on the same screen at the same time and input not be on top line

It's a simulation of the tv show LOST and the swan computer countdown timer from it.

Thanks!
sting251 wrote:
On the ti 84 plus ce, is their a way in ti basic for two things in a code to happen simultaneously while one is an input, and one is a if then check

I'm making a timer, and want go find a way for if to count down and I've a button isn't pressed by the time the timer runs out, you lose.

Also, I want to know if I can have an Output( and Input on the same screen at the same time and input not be on top line

It's a simulation of the tv show LOST and the swan computer countdown timer from it.

Thanks!

I believe that is impossible (although you can make it seem like it happened at the same time)
because the processor can only do one thing a time.
What I mean is like have the input pop up, and the timer keep going until it rubs out
You cannot have your program update the timer while the Input is running. You can, however, make your own version of the Input command using getKey, and update something displayed on the screen using Output() while you periodically poll the keyboard with getKey.
sting251 wrote:
What I mean is like have the input pop up, and the timer keep going until it rubs out

maybe if you run a subroutine? But I think the input or prompt halts the program
if you want you can use get key
Would that work if it is a series on numbers to input?
sting251 wrote:
Would that work if it is a series on numbers to input?
That would work very nicely. You can use getKey to detect keys [0]-[9] as well as maybe [DEL] and [ENTER], and of course add the necessary logic to track the digits being typed and the cursor position, and convert the result to a number when the user presses [ENTER] (expr() should be enough).
Thanks! That will be a big help!
How do I do multiple buttons get Key?
sting251 wrote:
How do I do multiple buttons get Key?

the same way? But assign them different variables.
K thanks
Here's an example routine that does what you are suggesting. It will visibly count down a ten second timer while checking user input. If enter is pressed before ten seconds elapses, you win. An L is taken otherwise.

Code:

ClrHome
Output(2,1,"Press ENTER
startTmr->T               //Sets the time used by checkTmr(
Repeat not(E) or K=105    //Loops until either enter is pressed (K=105) or time is up (not(E))
   10-checkTmr(T->E       //Stores a counted DOWN from ten (contrary to the normal counting up) to E
   Output(1,1,E
   getKey->K              //Stores keypress to K
End
If E
Then
   Output(3,1,"You WIN!"
Else
   Output(3,1,"You LOSE!"
End
Pause
Got it thanks. About to try that

EDIT: Is there a way for that code to count on minutes and not seconds?
sting251 wrote:
Is there a way for that code to count on minutes and not seconds?

Certainly!

Code:
ClrHome
Output(2,1,"Press ENTER
startTmr->T
Repeat not(E) or K=105
   10-checkTmr(T->E       //Change the "10" in this line of code to whatever amount of seconds you need! For minutes, just multiply the minutes you need by 3 and put that number there.
   Output(1,1,E
   getKey->K
End
If E
Then
   Output(3,1,"You WIN!"
Else
   Output(3,1,"You LOSE!"
End
Pause
Can the countdown output onscreen be in minutes and not seconds
Replace Output(1,1,E) with Output(1,1,int(E/60)) probably.
Can't other commands run while the seq( command is being executed?

Although the way CalcMeister showed is much easier to understand, couldn't one take input while the seq command runs, and if it ends before the correct answer is chosen, you lose a life or whatnot?
Quote:
Can't other commands run while the seq( command is being executed?

Although the way CalcMeister showed is much easier to understand, couldn't one take input while the seq command runs, and if it ends before the correct answer is chosen, you lose a life or whatnot?

I'm not sure where the seq( command would be useful here. Could you elaborate?

The following code will no longer display simply seconds, but minutes, followed by seconds. The code can be tweaked a little if you want to include hours, or minutes above 100, or just minutes and no seconds.

Code:
ClrHome
Output(2,1,"Press ENTER
Output(1,3,":
startTmr->T
Repeat not(E) or K=105
   10-checkTmr(T->E
   Output(1,1,iPart(E/60
   Output(1,4,remainder(E,60
   getKey->K
End
If E
Then
   Output(3,1,"You WIN!"
Else
   Output(3,1,"You LOSE!"
End
Pause
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?
You would need to add some If conditions in the Repeat loop. If you want a series of keypresses to be inputed, I think the easiest thing would be to have a list of stored values in L1, for example, and store the users keypresses into another list (for this to work correctly you would probably need a Reset key in case the user makes a mistake, and you would probably want to display they sequence that the user has typed in so far on the screen so they know whay they have typed, unless you want it to be like a hidden password of some sort). Then you can add an If condition that compares the Lists to each other (If L1=L2), and if it is true, you can either exit the loop or add in some code, whatever you need.
  
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 1 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