Page 1 of 1

Saving the contents of a stack in another file

Posted: Thu Dec 12, 2013 10:29 am
by nrmair
Hello forum members,
Ok so my problem is that I can't figure out how to save my stack in another file which can then be opened from within the stack again. Currently I am studying computing at school and must complete a project with several "complex" functions so as to get a good grade. I have made a text based game and one of the complex functions I thought would be good was the ability to save the progress made in the game. Unfortunately I can't quite find a way of saving anything other than text to another file. I tried the "save" command but that literally saves the stack which I guesses would be the case. So my question is, is it possible to save the content of everything in a stack to file in a way that it can be opened again like other games offer? The idea being that I need to save the contents of certain variables that have changed due to the players actions such as picking up items etc. Any help is much appreciated. Thank you!

Re: Saving the contents of a stack in another file

Posted: Thu Dec 12, 2013 11:09 am
by Mark
Hi,

If you want to save the coordinates of buttons, the contents of images etc., you might as well save the stack itself in a writable place. Just make a splash stack that either opens the stack or creates a new one:

Code: Select all

put specialfolderpath("documents") & "/app name/stackwithcontents.rev" into myPath
if there is a stack myPath then
  go stack myPath in new window
else
  clone stack "your substack" // this stack is now open
  save it as myPath
end if
Kind regards,

Mark

Re: Saving the contents of a stack in another file

Posted: Thu Dec 12, 2013 3:45 pm
by nrmair
Ok Mark, I will give this a shot tomorrow as that is when I have my next lesson, thank you very much