- Edited
The jist of the program is to basically make an itinerary and then save what someone has written down on the TextEdit nodes. As of right now, when I press the "load" button, it just says null. Why? I even followed a tutorial for it.
Save code:
extends Node
const SAVEFILE = "user://save_file.save"
var i_data = {}
var textInput1 = ""
func _ready():
load_data()
func save_data():
var file = File.new()
file.open(SAVEFILE, file.WRITE)
file.store_var(i_data)
file.close()
func load_data():
var file = File.new()
if not file.file_exists(SAVEFILE):
i_data = {
"itinText1": textInput1,
}
save_data()
file.open(SAVEFILE, File.READ)
i_data = file.get_var()
file.close()
Save and load button code:
onready var save_data = Save.i_data
func _on_SaveButton_pressed():
Save.textInput1 = textInput1.text
Save.save_data()
print(Save.textInput1)
func _on_LoadButton_pressed():
textInput1.text = "%s" % [save_data.itinText1]