old code in gdscript2.0

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Folivora

when the godot4.0 update came along alot of the script changed
i have been trying to figure out how to write old code in gdscript2.0

i had no luck with trying to do this one:
“export(String, FILE, “*.json”) var dialog_file”.

:bust_in_silhouette: Reply From: spaceyjase

Fortunately the documentation is up-to-date here: GDScript exports — Godot Engine (stable) documentation in English

Assuming you want a string to file:

@export_file("*.json") var dialog_file

sorry for the inconvenience just stumbled across another one

“func load_dialogue():
var file = File.new()
if file.file_exists(dialogue_file):
file.open(dialogue_file, file.read)
return parse_json(file.get_as_text())”

tried using the new “fileaccess” but i think i did it wrong

Folivora | 2023-03-31 15:15