Building a multiple .ged game with transferable variables?

Non-platform specific questions.

Building a multiple .ged game with transferable variables?

Postby BloodRedDragon » Tue Jun 07, 2011 11:38 am

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:
Current projects:
Techno-Tank Arena: on hold
Techno-Tank SuperPortal (working title): 0.1%
Bowels of Galaxies: 35% (was a bit too optimistic)
User avatar
BloodRedDragon
 
Posts: 123
Joined: Tue Jan 29, 2008 10:07 pm
Location: The Underworld
Score: 5 Give a positive score

Re: Building a multiple .ged game with transferable variable

Postby schnellboot » Tue Jun 07, 2011 12:13 pm

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");
schnellboot
 
Posts: 819
Joined: Sat Mar 31, 2007 1:35 pm
Location: Germany
Score: 102 Give a positive score

Re: Building a multiple .ged game with transferable variable

Postby savvy » Wed Jun 08, 2011 2:34 pm

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
--> For my help, i ask for a simple +1 if it helps! ^-^
--> I dont code, I type art which you dont understand.
--> I keep winning the 3D model challenge at college, teacher says: "you keep winning im not giving you prizes".
User avatar
savvy
 
Posts: 494
Joined: Wed Jun 03, 2009 11:55 am
Location: England
Score: 44 Give a positive score

Re: Building a multiple .ged game with transferable variable

Postby BloodRedDragon » Fri Jun 10, 2011 5:55 pm

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
Current projects:
Techno-Tank Arena: on hold
Techno-Tank SuperPortal (working title): 0.1%
Bowels of Galaxies: 35% (was a bit too optimistic)
User avatar
BloodRedDragon
 
Posts: 123
Joined: Tue Jan 29, 2008 10:07 pm
Location: The Underworld
Score: 5 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest