Hello.
I have a Project where i load txt-files that have the same name as the variable txtvar, so is txtvar 1 then it loads 1.txt as variable stext, then the richtextlabel called story outputs stext.
This works fine. Now i want, that i can use variables in my txt-files, but it takes the whole file as string and dont look for variables. How can i do that?
Code Snippet:
func _process(delta):
var stext = load_text_file("res://txt/u01/"+str(txtvar)+".txt")
get_node("story").bbcode_text = stext
func load_text_file(path):
var f = File.new()
var err = f.open(path, File.READ)
if err != OK:
printerr("Could not open file, error code ", err)
return ""
var stext = f.get_as_text()
f.close()
return stext