Saving variables.

Non-platform specific questions.

Saving variables.

Postby Hblade » Sun May 10, 2009 5:40 am

I am using variables in one .exe file and I'd like to load the same variables in a different exe file. The variables are very usefull, and are needed in both programs. I also need them to be the same values as they were when the new program was loaded.

HP: 89

When I load the different .exe file, I wan't the HP to still be 89.
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: Saving variables.

Postby skydereign » Sun May 10, 2009 6:06 am

You would just maintain the same save/load. If your variable is HP, the variable group would be hp. When saving the variable,
Code: Select all
saveVars("HP.sav", "hp");

When loading,
Code: Select all
loadVars("HP.sav", "hp");


What you need to make sure is that you are saving and loading the same group name and file. Both games need the same variable, aside from that there is nothing else to it.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Saving variables.

Postby Hblade » Sun May 10, 2009 6:08 am

Yay.
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron