Or you can save the data in a binary file. Each character could have it's variables in a UDT.
Code:' Type for storing character's data Public Type Character_Values cvLife As Integer cvHealth As Integer cvName As String ' etc., etc. End Type ' Array of characters Public udtChar() As Character_Values Public Sub SaveGame() ' Save a game to a file Dim ff As Integer, lNum As Long ff = FreeFile Open App.Path & "\game.dat" For Binary As #ff ' How many characters are there? lNum = UBound(udtChar) Put #ff, , lNum ' Save data Put #ff, , udtChar() Close #ff End Sub Public Sub LoadGame() ' Load a game from a file Dim ff As Integer, lNum As Long ff = FreeFile Open App.Path & "\game.dat" For Binary As #ff ' # of chars... Get #ff, , lNum ' Resize arrary and load data Redim udtChar(lNum) Get #ff, , udtChar() Close #ff End Sub




Reply With Quote