Source language: Translate to:

Save command for users

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

Save command for users

Postby kennyray23 » Wed Dec 07, 2011 12:53 pm

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?
kennyray23
 
Posts: 11
Joined: Sat Nov 19, 2011 12:09 pm

Postby Wrangler » Wed Dec 07, 2011 1:26 pm

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.
Wrangler
--------------
"You never know about a woman. Whether she'll laugh, cry or go for a gun." - Louis L'Amour

Windows 7 Ultimate SP1 64bit
16GB Ram
Asus GTX 950 OC Strix
Software made with NeoBook
http://highdesertsoftware.com
User avatar
Wrangler
 
Posts: 1507
Joined: Thu Mar 31, 2005 11:40 pm
Location: USA

Postby kennyray23 » Wed Dec 07, 2011 2:16 pm

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.
kennyray23
 
Posts: 11
Joined: Sat Nov 19, 2011 12:09 pm

Postby HPW » Thu Dec 08, 2011 1:16 am

Take a look in the doc for the commands FileOpenBox/FileSaveBox.
This will allow to do what you want.
Hans-Peter
User avatar
HPW
 
Posts: 2520
Joined: Fri Apr 01, 2005 11:24 pm
Location: Germany

Postby kennyray23 » Thu Dec 08, 2011 5:53 am

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....
kennyray23
 
Posts: 11
Joined: Sat Nov 19, 2011 12:09 pm

Postby dpayer » Thu Dec 08, 2011 9:18 am

kennyray23 wrote: It wasn't what I expected the process to be, but hell, it works....


Welcome to Neobook. :)

David P.
User avatar
dpayer
 
Posts: 1383
Joined: Mon Apr 11, 2005 5:55 am
Location: Iowa - USA


Return to NeoBook Action Commands

Who is online

Users browsing this forum: No registered users and 0 guests