This code is giving me an error the first time the file is created. Then when the game is run again, it gives me a error reading from stream error since the created file is 0 bytes.
SaveFile:String = "Data\Blitzogger.rank"
Method Load()
' open the savefile
Local File:TStream = OpenStream(SaveFile)
' if the savefile couldn't be opened
If File = Null
' create a new rank file
CreateFile("Data\blitzogger.rank")
' set inital rank points
WriteInt(File, 0)
' return 0 rank points
Points = 0
' otherwise a rank file excists
Else
' so get the players total rank points
Points = ReadInt(File)
EndIf
' close the file
CloseStream(File)
EndMethod
Any assistance in this matter would be greatly appreciated.
Sincerely,
Blitzogger
|