Topic was automatically imported from the old Question2Answer platform.
Asked By
NeiPodam
I made a save and load system and I’m sure that save works fine because I made two buttons, one changes variables other one save files. I used a hex editor and the value was equal to variable so it works. But problem is with loading. I have an button that calls LoadData() function (shown bellow)
func LoadData():
var SFile = File.new()
if SFile.file_exists(SavePath):
var SError = SFile.open(SavePath, File.READ)
if SError == OK:
var GameData = SFile.get_var()
SFile.close()
print(GameData)
After pressing load value should show in a label. Bellow is a dictionary:
And as I said after loading this “Level” variable should be shown in this label but it’s not. Default value is 0 and it’s showing 0 after running again and pressing load button even though hex editor shows right value. I also tried using “print()” to check if LoadData() function reads it right and it does because it printed out everything right. print(GameData)
Yes It is in another script but I put it in Autoload.
NeiPodam | 2022-06-17 20:55
Hi I am sorry I have been drinking so I really shouldnt have come on here to answer any questions. Below is some code I wrote for an old game which worked, hopefully it will help you.