Page 1 of 1

LoadVar/SaveVar help?

PostPosted: Thu Dec 16, 2004 12:10 am
by willg101
I would like to know a bit about the LoadVar/Save var commands & how to use them... :shock: :idea:

PostPosted: Thu Dec 16, 2004 12:09 pm
by makslane
You can use saveVars and loadVars to save and load any variables in your game, like highscores, current lives...

To use this functions, you must use the "Save group" field in the "Add New Variable" panel (Variable button in Script Editor).

For example, you create a score variable and put on the "High Score" group.

Now, you create more two variables, lives and energy, and put on "Actor State" group.

When your player die, you can use saveVars("game.sav", "High Score"); to save only the current player high score without save the player state.

When the user exit your game, you can use saveVars("game.sav", "Actor State"); to save the current player state (lives and energy).

Note, you can save different variable groups in a same file (game.sav).


Now, just use loadVars("game.sav", "High Score"); and loadVars("game.sav", "Actor State"); in the proper location in your game!

thanks

PostPosted: Thu Dec 16, 2004 9:54 pm
by willg101
thanks...
but like, could you give me an example?
I know this probably chews up your time, but i'm only 13... :oops:

PostPosted: Fri Dec 17, 2004 12:00 am
by makslane
What you think to do with save and load vars?

reply

PostPosted: Fri Dec 17, 2004 8:39 pm
by willg101
I want to save, or export an object's x/y psoitions.

PostPosted: Sat Dec 18, 2004 12:21 am
by makslane
Load the file: http://game-editor.com/examples/savevars.ged

In the "Create Actor" event, the position will be load
In the "Mouse Button Up" event the position will be save

Click and drag the actor, exit the game and run again.
You actor will go to the las saved position

is there anyway to save an actor's textNumber?

PostPosted: Wed Jan 12, 2005 1:39 am
by willg101
is there anyway to save an actor's textNumber :?:
(please give examples if possible :oops: )

PostPosted: Wed Jan 12, 2005 12:32 pm
by makslane
In savevars.ged example you have two Global, real variables (xpos and ypos) saved on "actor position" group.

Create other variable (Global, Real, "actor position" group), save_textnumber.

And update like the xpos and ypos vars:
After load:

textNumber = save_textnumber;

Before save:
save_textnumber = textNumber;

PostPosted: Thu Jan 13, 2005 2:10 pm
by LEO (LCG)
Gee! I understand the stuff just reading those posts...

This forum is a tutorial itself!

hhaha

PostPosted: Fri Jan 21, 2005 10:35 pm
by willg101
hahaha
I only through examples, so you're lucky sourcerer!

PostPosted: Tue Jan 25, 2005 9:11 am
by ingsan
Hello !
Sorry for that stupid question (I just woke up and I'm up to just 50 % of my "normal" state) but, Maxslane, why did you put an EventEnable event on MouseButtonDown[Left] ?
Well, I never really knew the use of that event actually ...

PostPosted: Tue Jan 25, 2005 1:07 pm
by makslane
It's only a dummy action to use the mouse drag option