Most basic way to write and save data to a file.

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

I would like to know the the most minimal way to open up a fresh project and write a script that will create and save helloWorldStuff to a file that will appear in my project res:// folder that I can immediately open (either with godots script editor or an external text editor) and validate with my own two eyes that yes it indeed wrote exactly what I told it to write in the file.

Reason:
I have prior knowledge of c++ and glm and I have been working in blender for a few years so I decided that it might be time to try and get into 3d game designing. I have been spending the last few weeks reading about GDScript and ive been scripting simple helloworldish scripts to get used to handling dictionaries and seeing if arrays behave like I remember them and now I’m at a point where I’m trying to figure out how to generate a file from a script (for example say I need to make a dictionary with 125 entries. instead of writing all of them it would be useful if I could write a script that generates them and saves it as a file.) My problem is I have no idea how to do this in godot and the google searches are leaving me frustrated because they try to cover more than what I am trying to learn at the moment.

:bust_in_silhouette: Reply From: eons

Have you seen the documentation, the system for saving files showed there is pretty much a basic one.

And remember that you should not save in res:// because that is the game data virtual filesystem, save your files on user:// or any other place where the game will have read and write permissions.

thank you very much on warning me about saving in res:// but the issue with user is that I use linux and all the places people suggest it to be are windows and osx directories, I’ve checked my user folder which would more likely have write permissions aside from my root folder. I’ve tried searching my file name too and nothing comes up. (I have not tried launching godot is sudo mode yet though) I really don’t know where it is saving to because I can’t find any path settings in godot project settings and when I try to designate a specific path to in the script it never shows up there either :confused:

garrettnr | 2019-04-17 16:54

and yes I have consulted the documentation.

garrettnr | 2019-04-17 16:55

can’t plus one on a comment, but I’d like to know the answer to this too

Agentfox | 2019-07-29 20:01