Easiest way to retain the values of 30 variables, during SD
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Easiest way to retain the values of 30 variables, during SD
What is the Easiest way to retain the values of 30 variables, during Shutdown?
I have a game that I want to save the names, scores and dates of the top ten players.
Any help will be appreciated!
Thanks,
David
I have a game that I want to save the names, scores and dates of the top ten players.
Any help will be appreciated!
Thanks,
David
Re: Easiest way to retain the values of 30 variables, during
Hi David,
sure!
I would do like this:
1. Create a TAB and CR delimited list from your variables
player1 TAB score1 TAB date1
player2 TAB score2 TAB date2
etc...
2. Save that list in a text file in the users "documents" folder:
3. Then on openstack read the file in again, if available:
You get the picture
Best
Klaus
sure!

I would do like this:
1. Create a TAB and CR delimited list from your variables
player1 TAB score1 TAB date1
player2 TAB score2 TAB date2
etc...
2. Save that list in a text file in the users "documents" folder:
Code: Select all
...
put tListOfTopPlayers into url(specialfolderpath("documents") & "/highscores")
...
Code: Select all
...
put specialfolderpath("documents") & "/highscores") into tHiScore
if there is a file tHiScore then
put url("file:" & tHiScore) into aVariable
## do whatever you like with aVariable
end if
,,,

Best
Klaus
Re: Easiest way to retain the values of 30 variables, during
Klaus,
This will be a first using files in LC and we will see how things go.
I really appreciate you providing some example code!
Thanks for your incredibly fast response!
David
This will be a first using files in LC and we will see how things go.
I really appreciate you providing some example code!
Thanks for your incredibly fast response!

David
Re: Easiest way to retain the values of 30 variables, during
I probably should have mentioned that this is for an android app.
Re: Easiest way to retain the values of 30 variables, during
Hi David,
specialfolderpath("documents") is also available on Android
Best
Klaus
specialfolderpath("documents") is also available on Android

Best
Klaus
Re: Easiest way to retain the values of 30 variables, during
Klaus,
You guidance has lead me to a maybe a simple solution. I was setting up some scroll fields to test load the variables into the file your suggested and I closed down the LC program and then reopened it. I was pleasantly surprised that the data was still in the content of “scrolling field” object (it makes since that it would be there, I am just not that sharp this morning). So I think I will try this method of saving small amounts of data, before trying the file storage method and see what happens. Without your inspiration I would not have found this option.
Thanks,
David
You guidance has lead me to a maybe a simple solution. I was setting up some scroll fields to test load the variables into the file your suggested and I closed down the LC program and then reopened it. I was pleasantly surprised that the data was still in the content of “scrolling field” object (it makes since that it would be there, I am just not that sharp this morning). So I think I will try this method of saving small amounts of data, before trying the file storage method and see what happens. Without your inspiration I would not have found this option.
Thanks,
David
Re: Easiest way to retain the values of 30 variables, during
Hi David,
yes, this surely works in the IDE but will NOT in a standalone,
since a standalone (stack) cannot save itself!
Best
Klaus
yes, this surely works in the IDE but will NOT in a standalone,
since a standalone (stack) cannot save itself!
Best
Klaus
Re: Easiest way to retain the values of 30 variables, during
WOW!!!
That surely would have caused me a lot of PAIN!
How is it that I can change Button labels in the standalone and not the content of a field?
That surely would have caused me a lot of PAIN!
How is it that I can change Button labels in the standalone and not the content of a field?
Re: Easiest way to retain the values of 30 variables, during
Hi David,
I am talking about the mainstack and all its substacks that will go into the standalone.
Best
Klaus
Well, you can change and modify everything in a standalone, but this will NOT get saved!DR White wrote:How is it that I can change Button labels in the standalone and not the content of a field?
I am talking about the mainstack and all its substacks that will go into the standalone.
Best
Klaus
Re: Easiest way to retain the values of 30 variables, during
Klaus,
Thanks so much for saving me from so MUCH PAIN!
Now, I will go back to see if I can make the file method work for me.
David
Thanks so much for saving me from so MUCH PAIN!
Now, I will go back to see if I can make the file method work for me.
David
Re: Easiest way to retain the values of 30 variables, during
Please give me an example for creating a text file.
I am not having much success with the above code. I am most likely doing something wrong.
Thanks,
David
I am not having much success with the above code. I am most likely doing something wrong.
Thanks,
David