Page 1 of 1

Building a multiple .ged game with transferable variables?

PostPosted: Tue Jun 07, 2011 11:38 am
by BloodRedDragon
Hey its me again...
I know that you can use the LoadGame function to make multiple levels across more than one .ged file or .exe, whatever. But is it possible to save variables in one .ged and copy them to another so they can be loaded?
Say I have a game where there are five levels for each of the two .ged files. I have collected 150 coins in one half of the game and I want to still have those coins when I play the other half i.e. the other .ged file.

Tell me if this is at all possible, or if I'm just speaking gobbledy gook.
Cheers! :D :mrgreen:

Re: Building a multiple .ged game with transferable variable

PostPosted: Tue Jun 07, 2011 12:13 pm
by schnellboot
use saveVars() and loadVars()

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");

Re: Building a multiple .ged game with transferable variable

PostPosted: Wed Jun 08, 2011 2:34 pm
by savvy
yes, if you use savevars and loadvars it saves the variables you wish to save or load in a seperate 'file' so that they can be loaded by a seperate exe or ged.
you need to set a group to the variable, then saveVars("save", lives); would save all the variables which belong to the group 'lives' into a file named 'save'.
to load these use loadVars("save", lives);

(may need "" around the lives bit, just use the ready made function thing in script editor anyway :P)

any help?

savvy


@shnellboot: your post looked very daunting XD

Re: Building a multiple .ged game with transferable variable

PostPosted: Fri Jun 10, 2011 5:55 pm
by BloodRedDragon
Schnellboot's post just looked a bit copied from somewhere else. Thanks, i just needed to know whether the save files can be loaded and saved from/into different geds.
Perfect awnser :D should begin on my beastly run and gun adventure game now :D