Page 1 of 1

Save command for users

PostPosted: Wed Dec 07, 2011 12:53 pm
by kennyray23
I have a game that I have created for teachers. It is a Jeopardy type of game that allows the teacher to add topics and questions so they can customize the game to whatever subject they teach. The first few pages of the publication walk the teacher through adding topics and questions by adding text in the TextBoxes I have provided. I would like for the teacher to be able to save the program after they have created all their topics and questions so they may access the program on their computer at a later date....(keeps them from having to make a new game each time they run the program). I have tried to save all the variables and create a open variables command, but nothing happens when I do this...What is the best way to allow the user to save a customized program?

PostPosted: Wed Dec 07, 2011 1:26 pm
by Wrangler
I would write any data you want to save to a text file as it is entered. One per line. Then read the appropriate line number when you want the data. You could also do this using NeoDB plugin database. I think writing to a file is faster though, and less coding.

PostPosted: Wed Dec 07, 2011 2:16 pm
by kennyray23
I appreciate the response, but is there a way to create a new file name for the program and save it on the users hard drive? Since I posted the previous post, I was able to save the variables and retrieve them when the user restarts the program, but it will only retrieve one instance (or the previous save.) I would like to allow the user to save the variables and name the variable file to whatever they like so it can be accessed at a later date. I think if they have the ability to enter in data to the program and then save the variables to a .var file, that would allow them to open whatever saved version of the game they wish.

PostPosted: Thu Dec 08, 2011 1:16 am
by HPW
Take a look in the doc for the commands FileOpenBox/FileSaveBox.
This will allow to do what you want.

PostPosted: Thu Dec 08, 2011 5:53 am
by kennyray23
Well after some tinkering around and using Wranglers suggestion about making each TextBox into a line in a .Txt file, I managed to make it work. I didn't realize that the only document I could generate and save with NB was a .txt file. Once I saved the variables in a .txt file, I was able to recall the variables once the user selected the .txt file they created. It wasn't what I expected the process to be, but hell, it works....

PostPosted: Thu Dec 08, 2011 9:18 am
by dpayer
kennyray23 wrote: It wasn't what I expected the process to be, but hell, it works....


Welcome to Neobook. :)

David P.