Page 1 of 1

In-Game File Deleting

PostPosted: Fri Oct 01, 2010 9:39 pm
by BlenderFreak
Can someone please send me a script that will allow me to delete a file called "data.sav" from the game itself? I can obviously go in and manually delete the save file, but I'd like to set the game up so that when the "NewGame" tab is clicked on in the main menu, a data.sav will be deleted and the game will start from the beginning.
Data.sav is created when your character reaches a checkpoint.

On a similar note, I used Bee-ant's checkpoint tutorial ( http://game-editor.com/forum/viewtopic.php?f=4&t=8744 ) to create the method of saving, but if someone could give me a brief tutorial on how to save the score for the game, that would be pretty awesome, too! Let me know if you can provide an answer! Thanks a million!

-BlenderFreak

P.S. Sorry about all the questions - trying to teach myself GE as fast as possible so I can get started on a *real* project instead of a cheap-graphic deal. XP

Re: In-Game File Deleting

PostPosted: Sat Oct 02, 2010 12:14 am
by DilloDude
In GE, there is no way (as far as I'm aware) to actually delete an external file. You can, however, completely clear its contents or reset its data when you want to start a new game.

Re: In-Game File Deleting

PostPosted: Sat Oct 02, 2010 3:09 am
by BlenderFreak
Ah alright - that's basically what I was wanting. How do you do that, exactly?

Re: In-Game File Deleting

PostPosted: Sun Oct 03, 2010 10:21 pm
by Rux
What you do is you is you set all your variables to 0, and all your strings set to "", EXAMPLE
Code: Select all
variable1 = 0;
strcpy(string1, "");
//rest of your variables


Then you use save vars and save all the save groups to data.sav. There you go.

EXAMPLE
Code: Select all
variable1 = 0;
strcpy(string1, "");
//rest of your variables
saveVars("data.sav", "INSERTSAVEGROUPHERE");

Re: In-Game File Deleting

PostPosted: Sun Oct 03, 2010 11:07 pm
by BlenderFreak
Thanks! That should work! :D