Page 1 of 1

save var

PostPosted: Fri Apr 08, 2011 4:31 pm
by Behdadsoft
Hi

I put the variables are stored, are stored in a folder. To do this, what should I do?

Re: save var

PostPosted: Fri Apr 08, 2011 11:28 pm
by skydereign
Use the saveVars function. When you put a variable in a save group, you just need to save the save group. This is from the script reference.
http://game-editor.com/docs/script_reference.htm

Save functions
Use saveVars and loadVars to save and load any variables in a game, like highscores, current lives, etc. To use these functions, you must use the "Save group" field in the "Add New Variable" panel (Variable button in the Script Editor).
saveVars: Save all variables in the group to the specified file.
The file will be saved in the game directory.
void saveVars(char *file, char *group)
Use saveVars to save any variables in a game; highscores, current lives, etc.
You must use the "Save group" field in the "Add New Variable"panel (Variable button in the Script Editor).

Script Editor Syntax:
saveVars("game.sav", "High Score");

loadVars: Load all the variables in the group from a specified file.
void loadVars(char *file, char *group)


Script Editor Syntax:
loadVars("game.sav", "High Score");

Example:
1. Create a "score" variable and put it in the "High Score" group.
2. Create two more variables: "lives" and "energy". Put these variables in the "Actor State" group.

When the player dies, use saveVars("game.sav", "High Score"); to save the current player's high score without saving the player's state.
When the user exits the game, use saveVars("game.sav", "Actor State"); to save the current player's state (lives and energy).
Note: different variable groups can be saved in the same file (game.sav).
Finally, use loadVars("game.sav", "High Score"); and loadVars("game.sav", "Actor State"); in the proper script editor area of the game!

Re: save var

PostPosted: Sat Apr 09, 2011 7:29 am
by Behdadsoft
Thank you, but I mean not just speech.
I like variables in a folder named save, they save

Re: save var

PostPosted: Sat Apr 09, 2011 7:34 am
by skydereign
Oh, assuming I understand you this time, if you want to put the save file in a folder in your game directory you can't.

Re: save var

PostPosted: Sat Apr 09, 2011 12:50 pm
by Behdadsoft
No matter, thank you.