Hello!

I am currently working on a mini-game for the TI-83 series, but had a question with Strings. I saw on another program that You can have a user input a string in which allows for saving names. I wanted to save player's names for high scores, but I do not want to use a single string for each name as there are only 10 strings allowed on the calculator.

My plan was to save each name onto a single string, but I am not sure how to add substrings into a single string. If that was unclear, then maybe this will explain it. One string (Str0) is set aside as the string that the high scores will be displayed on. Another string (Str9) is the one that the player will type there name into. Then, Str9 will be inserted into Str0 in the appropriate place. So Str0 might be "Alpha Teach Utube". Then Str9 received the second best highscore thus Str9 is moved into Str 0 and that string becomes "Alpha Johan Teach".

This is probably really basic, but I hope its not an annoyance to answer !

-Alpha
An idea is to store each name in a list, each element = one character for example. Then it's much easier to sort/insert strings, and then 'compile' it back to strings, shouldn't be too hard.

Hope this helps
PT_ wrote:
An idea is to store each name in a list, each element = one character for example. Then it's much easier to sort/insert strings, and then 'compile' it back to strings, shouldn't be too hard.

Hope this helps

That doesn't work in my calculator. When I type letters into a list and enter it, it turns into a random number so that's why I thought I needed to use strings. (I have a TI-84 Plus CE)
You can't enter a string into a list, you have to *convert* a string into a list
My idea was to say that A=1, B=2 etc, so ALPHA = {1,12,16,8,1}. To sort all the lists, just take the first element of all the lists (and if necessary the second and so on) and sort them
PT_ wrote:
My idea was to say that A=1, B=2 etc, so ALPHA = {1,12,16,8,1}. To sort all the lists, just take the first element of all the lists (and if necessary the second and so on) and sort them
Thank you! I understand it now and that is pretty simple
I don't understand all of this talk about conversions when you can just input a string to begin with.

Here's an example of inputting a string, truncating it to 5 tokens, and inserting it into position X of Str0:

Code:
```Input "",Str9 Str9 While 5>length(Ans Ans+" End sub(" "+Str0,1,6X-5)+sub(Ans,1,5)+sub(Str0+" ",6X,length(Str0)-6X+2 sub(Ans,2,length(Ans)-2→Str0```
you could use sub ( which is like mid\$ In basic.
"Scott.....David.....Micheal...Andrew....Simon..... etc 10 names...spaced by 10 chars""-> Str0
for (X, 1,
output (4, X, sub (Str0, 10X, 9)

End

to overwrite default values. and prepare Str0...

"."-> Str0
for (X, 1, 100)
Str0+"."-> Str0
End

".........."-> sub (Str0,1, 9)
I dont know if the above will work, to try and try again with different methods may work. im not 100% sure didnt bring my calc with me today... xheckout a program listing I wrote in cemetech games further down the new posts list. I would like to know if theres anyone out there. ..∠different calcs have different features but if you have strings on it, theres many ways to shuffle pieces to another string and back again.... i usually take a piece of Str1 into Str2 then compile the long string again, "List of names......"-> Str1 , portion sub(Str1,10,19)->Str2 then remake Str1 like this sub(Str1,1,9)+"Newname.."+sub(Str1,20,79)->Str3, then Str3->Str1,,, where i used "Newname..." you could use +Str2+ instead.
ticalc strings can be much longer than 255 bytes/chars... free to copy the code belongs to all of us...
Ok, I don't know where this thread is headed exactly, but here is how I would do it I guess (it's the way that makes the most sense to me)
You start by making all the names the same length (i.e. taking the longest name and putting in characters to all the other ones to make them as long) like jacobly suggested.

Code:
```Input "",Str9 Str9 While 5>length(Ans Ans+". End ```
Obviously just change the 5 to the length of the longest name you have, then just add it to the string that contains the names

Code:
`Str0+Ans→Str0`

Then, when you want to take a name out of Str0, you put a number in A (1 for first name, 2 for 2nd, etc.) and simply do this:

Code:
```5A-4 sub(Str0,Ans,inString(Str0,".",Ans)-Ans```

The 5A-4 is based on the length of the names that you chose, just replace the 5 with the length that you put earlier, and the 4 is just that length -1, so if you chose 8 as the length, you would put 8A-7 instead.
I decided to go with converting the string to a list and then back again to a string to be displayed. Thanks everyone for the advice though !

Do you all think that I should post the game that I am using this for in the Your Projects?
You should most definitely share with us any projects you are working on

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.

»
» All times are GMT - 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