Multiple Save slots?

Posted by Shork on Sept. 9, 2006, 2:56 a.m.

I have constructed the beginnings of what I think could be a pretty good menu system. It has a save and load screen, and I want 3 save slots, each displaying the name of the character saved there. (I have a Final Fantasy style name creation screen, you have to select each letter from a grid using the arrow keys, it's totally old-school and uses a bitchin' amount of if-statements becuase I can't code for shit.) I have been using arrays to store all the data though, (The menu doesn't need to run that fast, it's a menu.) but an array has to be remade every time the game is started up, so that starting the game and going to the load screen says all three slots are empty, becuase it just assigned empty to those values. I have looked in the examples sectiona and didn't find anything about multiple save files, but I think I remember seeing something about it here before. I may be wrong. It's like 3 am and I haven't slept in a couple days… yeah… So I'm thinking I need to save the name data to some external file, like a .ini or something? But I know nothing about .ini. Do you think that would work, or is there some other better and/or easier method?

Taken care of. Used an .ini. See below.

Comments

marbs 18 years, 3 months ago

the simple way to do it is to use the game_save() function, and for each save slot use a different file name e.g.

game_save("slot1.sav")

game_save("slot2.sav")

game_save("slot3.sav")

Shork 18 years, 3 months ago

So if I used something like:

game_save(global.PlayerName +".sav")

?

marbs 18 years, 3 months ago

game_save(string(global.PlayerName)+".sav")

it doesn't nessarily have to be .sav

shadowstrike32 18 years, 3 months ago

or you could save the data array to a binary file. that would work better for more selective data, and would seem more professional.

Shork 18 years, 3 months ago

hmmm… binary file. Where do I go to learn to do that?

Shork 18 years, 3 months ago

I have taken care of it using an .ini file. It was really easy and took me about 10 minutes to do the whole thing. I would like to thank grayfox for making such an easy to understand example that taught me everything I needed to know in 30 seconds.