This topic is now archived and is closed to further replies.


Making a Save Function

Recommended Posts

NeoMage    122
I''ve looked through tons of VB6 books, and I can''t figure out how the heck to make a save function for a game. I''m making an RPG right now, but it''s going to be pretty pointless to collect tons of items and slaughter hundreds of fiends if you can''t even save the game. Does anybody know how? -NeoMage

Share this post

Link to post
Share on other sites
Unwise owl    158
You just save all data in binary mode in a certain order, then you load that data in the same order later. If you got resizeable arrays you save the size before the actual array data, and then create the array from that size before you load the data. With VB''s built in functions this is pretty simple if your game data is limited to single variables, arrays and user-defined types.

If you don''t know about the functions to do file operations, check Open, Close, Put/Write and Read statements in the help file. It was a while since I did these VB things myself so I can''t offer any more specific help.

Share this post

Link to post
Share on other sites
Game_Dude_man    122
Like the guy said above, just save all the data you want to remember.

for an RPG (level, character stats, area, etc). You can even save it as text data if you want. You just have to make sure you load it all in the same way you sent it out when you want to load.

Name the file something like the main characters name, so yu can distinguish between different players.

Share this post

Link to post
Share on other sites
iNsAn1tY    476
You need to use VB''s Open, Put and Get statements, which you can use to write binary files:
Open MyFilename For Binary As #1

Dim MyBoolVar As Boolean
Dim MyIntVar As Integer

MyBoolVar = FALSE
MyIntVar = 42

Put #1, , MyBoolVar
Put #1, , MyIntVar

Close #1
Just use the Put statement to write to a file, and the Get statement to read from a file...

Windows 95 - 32 bit extensions and a graphical shell for a 16 bit patch
to an 8 bit operating system originally coded for a 4 bit microprocessor,
written by a 2 bit company that can''t stand 1 bit of competition.

Share this post

Link to post
Share on other sites