[Solved] How to save & load dialogue states for Yarn?

Refer title. I’m not sure to just put the file on GitHub since it’s not a bug, so I’ll put the zip on my Google Drive instead, which will be at the end of the post.
I didn’t find any mention for saving in the dialogue example tutorial, but if there’s one and I missed it, do notify.
Also long post because pictures.

To start: I’ve managed to implement storage function, and created an event to save dialogue state into global variable, then into Storage event. However the data isn’t actually being saved?
(This is from GDevelop Preview. GDJS_hiScore is from another game, which successfully reads the data into variable)

Okay, now details of my code:
Here’s my code to save into storage and deleting it:

The unopened arrows are Javascript console.log statements.

Here’s the dialogue, it starts at NPC0 and the dialogue variable is “choice1”. I set it to True if player picks first choice. False if second, and NPCNameStart is third choice, just text.


I’m not sure what else to add.
The wrong part could be the saving(text/value) or the Load and Save dialogue state actions I did.

The link (Investigations.zip): wip - Google Drive
It’s a folder, and anyone can edit it.
The dialogue file is in language/english.json.
The controls are WASD movement, E to talk (transparent blue collide with white npc), R to get out of dialogue freezing (I haven’t finished the dialogue system yet), T to save data into storage, and Y to clear storage (however if data is already loaded you’ll need to restart to clear global variables and dialogue state).
Esc to close the game (if it hasn’t crashed yet).

Thank you for reading and even more so if you can help!

PS: If you are looking how to do this, sorry! I will post the method at some point later. It involves structures (see link)and the Yarn command syntax. Just bump the topic if you’re interested (I may forget to elaborate this, I guess)

1 Like

ran in the same problem
can you tell me how you fixed it?

Hi potato-coder! Sorry, I forgot everything about this project. I don’t understand the code at all.
However, I’ve re zipped and uploaded it again on Google Drive, as Investigations-repackaged2021.zip: https://drive.google.com/drive/folders/1D5pvf2MVX77MuxsgO6lco-_hqmEXhzGS

I know that this is supposed to load the dialogue states stuff, it’s a structure variable…

And this loads a structure variable. The structure variable of the dialogue gets saved if you press G, I guess.
Most of the stuff happens inside “setVariable” and “compareVariable” conditions, which are Yarn actions that I trigger from the dialogue tree and stuff.

That’s honestly all I can figure out, I can’t be bothered to understand my work again right now :sweat_smile: take your time going through the project files, and hope it helps!

thanks that saved me lots of work :blush:

it worked thank you sooooo much

1 Like