#Can you answer my question on the forms?
4 messages · Page 1 of 1 (latest)
Start by declaring a config variable var config = ConfigFile.new()
Then in the ready function run config.load("path_to_config") - make sure path_to_config is NOT inside the res:// directory, as that won't work once built. Use the user:// directory instead.
To set a value, use config.set_value("category_name", "name", value)
To get a value use config.get_value("category_name", "name", default_value) - default_value is what to return if nothing has been set yet.
Finally, to save it back to the file, so changes aren't lost, use config.save("path_to_config")
huh, for me the path_to_config also works in res://
Using res:// for user data isn't recommended, as it doesn't properly exist once you export the project, which can mess with treating it as a directory. (Although ConfigFile might be able to work it) Not to mention it prevents saved data from being transferred, as it's bundled into the executable.