I'm unsuccessfully trying to set this up for a couple of days by now, so I finally decided to ask for help. I'd like to save the states of four checkboxes (red on/off, blue on/off, green on/off, yellow on/off) and load that latest state at restart.
From all I know I certainly need to create a file for that, one that should be accessible from any node/script. I find suggestions for *.txt-files but also for *.tres, (like "res://saves/my_checkboxes.tres"; I know I should opt for "user://" later...). I feel that "json" often is not recommended.
(Having a directory created when none exists yet also seems to be easily possible by something like
if not dir.dir_exists("res://saves/"):
Then there is the "File.WRITE" and "File.READ" approach to be found but also something like "RecourceSaver.save(...)" which I understand as part of some func loadeverything() and func saveeverything().
As I understand I have to "export"-mark the state-variables of my checkboxes in order to make them save-/loadable in the first place. I guess that in this case this means I need to somehow set the boolean in the checkbox-scene's script variables (I have a separately instanced scene for every checkbox).
A simple "save button" below my checkboxes emits a signal when pressed which my root-node receives, then performing the saving in the "signal-received" function ("save_everything()").
However, what I can't quite wrap my head around is how to make the bool-state being "registered" and "ready-made" for the save-function to acknowledge (and how to send such a state to another node/script in the first place – in fact I guess this is one of the issues particularly confusing me because this seems to work so differnetly from signals, which I can somewhat manage by now). But I have a feeling that this might lean towads the exporting in the first place ("export var checkboxes..."?). Actually, this really might be the biggest question mark of them all...
All in all, despite seemingly being such a little thing to accomplish, this turns out much more complex (and confusing) than I hoped for, so my humble question is if I may ask for some short step by step guidance (or maybe a link to an already existing one).
As I feel like having reached my wits' end here I'd very much appreciate any help.