LoadVar/SaveVar help?

Non-platform specific questions.

LoadVar/SaveVar help?

Postby willg101 » Thu Dec 16, 2004 12:10 am

I would like to know a bit about the LoadVar/Save var commands & how to use them... :shock: :idea:
http://www.wish-games.com
Old betas now available!!
User avatar
willg101
 
Posts: 473
Joined: Thu Dec 16, 2004 12:08 am
Location: West Michigan
Score: 5 Give a positive score

Postby makslane » Thu Dec 16, 2004 12:09 pm

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!
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

thanks

Postby willg101 » Thu Dec 16, 2004 9:54 pm

thanks...
but like, could you give me an example?
I know this probably chews up your time, but i'm only 13... :oops:
http://www.wish-games.com
Old betas now available!!
User avatar
willg101
 
Posts: 473
Joined: Thu Dec 16, 2004 12:08 am
Location: West Michigan
Score: 5 Give a positive score

Postby makslane » Fri Dec 17, 2004 12:00 am

What you think to do with save and load vars?
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

reply

Postby willg101 » Fri Dec 17, 2004 8:39 pm

I want to save, or export an object's x/y psoitions.
http://www.wish-games.com
Old betas now available!!
User avatar
willg101
 
Posts: 473
Joined: Thu Dec 16, 2004 12:08 am
Location: West Michigan
Score: 5 Give a positive score

Postby makslane » Sat Dec 18, 2004 12:21 am

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
Last edited by makslane on Fri Aug 25, 2006 12:59 am, edited 1 time in total.
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

is there anyway to save an actor's textNumber?

Postby willg101 » Wed Jan 12, 2005 1:39 am

is there anyway to save an actor's textNumber :?:
(please give examples if possible :oops: )
http://www.wish-games.com
Old betas now available!!
User avatar
willg101
 
Posts: 473
Joined: Thu Dec 16, 2004 12:08 am
Location: West Michigan
Score: 5 Give a positive score

Postby makslane » Wed Jan 12, 2005 12:32 pm

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;
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby LEO (LCG) » Thu Jan 13, 2005 2:10 pm

Gee! I understand the stuff just reading those posts...

This forum is a tutorial itself!
___________
Blessed are the pessimists for they have made backups
User avatar
LEO (LCG)
 
Posts: 24
Joined: Fri Jan 07, 2005 11:56 am
Location: Blanka's country
Score: 0 Give a positive score

hhaha

Postby willg101 » Fri Jan 21, 2005 10:35 pm

hahaha
I only through examples, so you're lucky sourcerer!
http://www.wish-games.com
Old betas now available!!
User avatar
willg101
 
Posts: 473
Joined: Thu Dec 16, 2004 12:08 am
Location: West Michigan
Score: 5 Give a positive score

Postby ingsan » Tue Jan 25, 2005 9:11 am

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 ...
User avatar
ingsan
 
Posts: 580
Joined: Mon Nov 17, 2003 4:02 pm
Location: Maurician LADY in FRANCE
Score: 6 Give a positive score

Postby makslane » Tue Jan 25, 2005 1:07 pm

It's only a dummy action to use the mouse drag option
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron