Page 1 of 1

Savestate doesn't load correctly...

PostPosted: Sat Dec 10, 2005 11:49 am
by StarFishDesign
I create a savestat file for reloading the score and therefore the actual position in the game:

When level1 exists i run following script:
saveVars("save.dat", "Savestate");
LoadGame("level2.dat");

On the beginning of level2, when the counter is created i run the following script:
loadVars("save.dat", "Savestate"); element_Score.textNumber = ScoreCounter;

But the counter is always showing zeroes when loading the next level

* ScoreCounter is my integer var for the score, which will be saved in the group Savestate.


By the way:
Is there an "if exist" routine available in GE?
I remember "if exists filename" on amiga... But how does it work in GE?

The score and therefore the last finished level should be loaded only if file"save.dat" exists.

Any help?

PostPosted: Sat Dec 10, 2005 2:03 pm
by Novice
When level1 exists i run following script:
saveVars("save.dat", "Savestate");
LoadGame("level2.dat");


If you ment "level1 exits" then i think that you should save vars before the game exits. If it is not a typo im afraid i cant help. :roll:

PostPosted: Sat Dec 10, 2005 2:03 pm
by regine
Test this Script:

loadVars("save.dat", "Savestate");
textNumber = ScoreCounter;

Or:

saveVars("save.dat",, "Savestate");
LoadGame("level2.ged");

PostPosted: Sat Dec 10, 2005 6:14 pm
by StarFishDesign
Novice wrote:
When level1 exists i run following script:
saveVars("save.dat", "Savestate");
LoadGame("level2.dat");


If you ment "level1 exits" then i think that you should save vars before the game exits. If it is not a typo im afraid i cant help. :roll:


I've set a Timer... Level 1 exists after 1 Minute.
When the Timer reaches this limit, the Savestate will be saved as written above, after that level 2 will be loaded.

The file "save.dat" will be saved, but not loaded correctly on Level 2.

PostPosted: Sat Dec 10, 2005 6:15 pm
by StarFishDesign
regine wrote:Test this Script:

loadVars("save.dat", "Savestate");
textNumber = ScoreCounter;


The variable name is missing in there - isn't it?

PostPosted: Mon Dec 12, 2005 12:20 pm
by makslane
I have checked the saveVars and loadVars functions and I have found no errors.
Please, make sure are you using the correct variable to save and load, and call the loadVars in some action.