I'm writing a program in TI-Basic in which I would like to save the value of each input so that the last value I have entered appears the next time I run the program, at which time I can change the value or keep the previous one.

Question. Is there a specific command for this in TI-Basic, or does it involve writing code for this purpose?
you would be best off saving the variables in a list so, if you have them all as REAL vars (A, B, D, X, L, Theta, etc.), then you would just do {*Var1*, *Var2*, *Var3*, etc.} -> *your list name here*.

then just recall each from the list in order to reset your vars as they were when you exited the program.

by the way, you should introduce yourself here: http://tinyurl.com/6cq7ph9.
Sorry for the lack of introduction. I haven't been involved in a forum in the past 15 years. Forgot my manners.

My name is Ron DiGiovanni, I live in Easton PA USA, and I manufacture hot air balloons for a living. (www.customnine.com)(www.bigappleballoons.com)

I am also interested in backyard celestial navigation and I recently decided to try writing a few sight reduction programs in TI-BASIC. The last time I dabbled with code was 25 years ago when I bought a Tandy PC-7 handheld computer for 50 bucks that wrote in Dartmouth Basic. For 25 years I carefully swapped out the two CR2032s in a religious ceremony every two years or so and managed to keep the thing going to this day without losing the original inputs.

Well, I finally decided that I needed to move into the 21st century of handhelds. Soooooo, I bought Kerm's book, bought a used TI-84 Plus (which seems to be nothing more than a TI-83 in reality) and here I begin anew.

Thanks again for your Var1, Var2, suggestion. I'm sure it will work well. That's all for now.
Actually it didn't work out so well, I haven't quite got it. Perhaps I'm not explaining this properly.

Let's say I write the program:

:Input "Long.=",L
:Input "GHA=",G
:Input "Dec=",D
:L+G+D->E
:Disp E

Let's say I run the program with inputs of 3,4, and 5 for variables L, G, and D respectively. What additional code can I add to this program to make 3,4 and 5 appear in the next run of the program so that I can simply leave them be and hit enter, or type over them?
You'd need something along the lines of:


Code:
ClrHome
Disp L,G,D
Pause
Menu("EDIT?","YES",1,"NO",2
Lbl 1
Input "Long.=",L
Input "GHA=",G
Input "Dec=",D
L+G+D->E
Disp E
Lbl 2


I think something like this might be your best and easiest solution, if I'm understanding your request correctly?
I believe he wants to duplicate the functionality of the SOLVE screen. In which case I would recommend to use the SOLVE screen.
Welcome aeroron. I maybe one of the more senior (in age terms only) members to appreciate the importance of the original Dartmouth Basic. You will feel at home here and with Kerm's excellent guidance get upto speed with TI-Basic easily. Data structures within TI-Basic are very rudimentary but utilising the "Lists" is similar to creating "Data" statements in older Basic. Have a look at TI-Basic Developer site: not much here that Kerm has not covered but it's a great online resource.
Weregoose wrote:
I believe he wants to duplicate the functionality of the SOLVE screen. In which case I would recommend to use the SOLVE screen.


Sorry, not familiar with the solve screen, so yeah, if that's what would work best, go with that.
Perhaps the best way for me to describe what I'm looking for here is to explain the way the Tandy PC-7 worked. The device was designed to create short programs for math solutions.

No matter what the program was that you were running, the PC-7 automatically retained the last entry for each variable. Therefore, in any subsequent run, when prompted for a variable, you need only hit the enter key to re-enter this same value, or you could type in a different value.

This feature worked well for repeated runs of the same program involving long math formulas in which one variable is being changed and all others are to remain the same. It saved the user the hassle of re-entering the same data over and over for each run. You could rapidly hit the enter key for all prompts except the one to be changed.

tifreak8x's solution looks interesting when I ran it. It's almost what I'm looking for and I will play further with it. However, I'm really looking for something that is more automatic and working behind the scenes rather than requiring further prompt.

I found solve( in the catalog listing. Is that related to the solve screen? If so, how does it work?

Thanks for the welcome ti83head. I suppose I'm severely dating myself with all this talk about dinasours.
The solve() command is very closely related to the Equation Solver indeed: it does exactly what the Solver does, but from a program. You can read about using it here.
Thanks Kerm. But is the solve command useful for the code I'm looking to write?

Once again, I am trying to write code that will more or less mimic my old Tandy PC-7 which automatically retains the value of variable entries from one run to the next, regardless of the program written.

The example I offered was:

:Input "Long.=",L
:Input "GHA=",G
:Input "Dec=",D
:L+G+D->E
:Disp E

What could I add to this which would retain the last entered value, from one program run to the next, so that I would not have to re-enter values for either L, G or D that I did not want to change?
I read in a different source that my quest has something to do with the "Archive" command.

Anyone know if the archive command or function would have any results here?
Archive is barking up the wrong tree.

If you know what letter variable an input is responsible for, you may use that very letter as the input. When prompted, writing a G as the hour angle will re-assign that variable's value back onto G, but this assumes that the value in question hasn't been modified between run-times.

Other than that, one might bother to code a near-facsimile of Input and call it as a subroutine, if only to edify himself.
Well now, that's obviously a start in the right direction.

The truth of the matter is, I wasn't aware that one could enter a variable as a value in a prompt. Guess it's time for me to re-read Kerm's book for the missed or forgotten tidbits. Now my sample program would read something like:

:Input "Long.=L=",L
:Input "GHA=G=",G
:Input "Dec=D=",D
:L+G+D->E
:Disp E

which indicates to the user the variable letter for repeat entries.

But now, as you pointed out, my problem is that the length of the program I am writing requires that I re-use all of the available variables at least once, thereby changing their original values. And not to sound ungrateful, but I was also hoping for greater automation.

But, this is certainly the right tree.
I'm not sure that I explicitly mentioned that you can type variables at a Prompt or Input, but if I didn't say so in my book, here's what you need to know: You can type almost any expression at a Prompt or Input that you would type on the homescreen, from simple arithmetic expressions to more complex commands. Whatever you enter will be evaluated before the OS returns the result (not the original expression) to the program. For example, "4+3" would give the program 7, "seq(X,X,1,10)" would give the program the list {1,2,3,4,5,6,7,8,9,10}, and "G" would give the program the number in the variable G.
Not sure if this was said because I skimmed through the last few posts, but the best solution I can think of is entering in the var of the input, granted you haven't overwritten it before with STO. So it shows, when running the PGRM:
Whatever's here=G
And blah=F
Dec=D
You enter G, F, and D as answers and it uses those nums stored to the vars

Sorry for replying to a 2 month old post, but I don't think it has been solved.
Well done! If three consecutive posts at the bottom didn't get the message across, always go for a fourth one.
  
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 1
» 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