This is probably a stupid question, but I've been tinkering with various solutions over the past several days and have gotten nowhere...

Anyway, I've been tinkering with both Godot and Dialogic (plug-in) for the past several days, and I want to find a way to store a 'randomly'-generated variable string as persistent data, so that I can re-load the data later and check it against a new 'randomly'-generated string and have the output behave differently if they match.

To hopefully explain this a bit better:
I currently have an RNG set up to pull a number from between 1-10. If the number is 5 or below, a variable is assigned one string based on that outcome, and if it is 6-10, a different string is assigned. This is working without issue.

The problem is that I would like to find a way to save that variable data to disk, so that when the program is re-started, it will open the saved file and check to see if one of the two strings is present. If one of the strings is present, my current thought (which I think should be able to be accomplished with a simple 'if' statement) is that it would bypass the RNG altogether and default to setting the variable value to the unused script (which would then also be saved to the same file upon completion, and if both strings are present in the saved file, Godot would go back to using the RNG to assign the value, regardless of what is written within the saved file).

I hope I clearly explained what I'm trying to do, and I'd appreciate any thoughts on the best way to approach this (especially since I would eventually like to be able to store several variables in such a way in order to trigger different behaviors within the program).

Also, for reference, I'm running Godot 4.1.1 and (if it matters) Dialogic 2.0 Alpha 9.

Thanks in advance

  • xyz replied to this.

    hifi3142 That's what resources are for. Make a custom resource class, instantiate an object of that class and put all data in there. Save/load the object as needed.