and I was following along with my own script, and I keep getting this error. Parser Error: Invalid argument for "get_var()" function: argument 1 should be "bool" but is "String".
Heres the code if that helps
var StringVar : String = "DefaultString"
const FileString = "res://SaveFilePath.save"
func save():
var File = FileAccess.open(FileString, FileAccess.WRITE)
File.store_var(StringVar)
File.close()
func Load():
if FileAccess.file_exists(FileString):
var File = FileAccess.open(FileString, FileAccess.READ)
StringVar = File.get_var(StringVar)
File.close()
else:print("Theres No Data Here")
Hello Me Again I forgot some parts of the code so I edited it to show what I was dealing with
func Load():
if FileAccess.file_exists(FileString):
var File = FileAccess.open(FileString, FileAccess.READ)
# Right Below this note
StringVar = File.get_var(StringVar)
# Right Above This Note
File.close()
else:print("Theres No Data Here")
This is exactly where I get this error! from what I gather the get_var() function is supposed to retrieve a variable from the save file, however the function only takes a bool for some other reason. In the tutorial he used multiple integers with the get_var() function like this.
var variable1 = 0
func load():
FileAccess.file_exist(save_path):
var File = FileAccess.open(save_path, FileAccess.READ)
variable1 = File.get_var(variable1)
How can i retrieve the string i saved in the save file?