GD5: load structured local files

Hello,

I’m new on using html5 platform of GD, and on GD5.
I’m currently working on a tiny project with gd5, and i can’t figure out how load and properly use a structured file… On GD4 it would not have been a problem on native platform and xml files, but i can’t use similar solution with GD5.

Basically, i wish to have multiple files containing all texts of my game (dialogs, ui , descriptions, etc.), in different langages : english, french, swedish, etc.
Regarding actions in GD5, i suppose the text should be formatted in JSon… But i fail to load a local file from the root folder (or subfolder) of the game… Is it at least possible (yet) with gd5 ? And will it work on any device (desktop and packed for android/ios) ?

Any idea ? I can’t figure what’s happen with action “load a structured file in memory” (and not even sure the file is loaded at all… i fail to access groups).

Thanks

Load .json resources is on the roadmap: https://trello.com/c/dT5esfRc/122-add-support-for-embedding-json-files-in-a-games-and-reading-them-from-events
It would let you add the files as resources and read them :smiley: , in the meantime you could just copy the entire json text and paste it in a scene/global variable, then convert the variable into a structure through events.

Ok Ty :slight_smile:

I’ve seen the discuss on github about loading JSon as ressource, but i was thinking i was missing something with the “load a structured file in memory” action.
I’ll use JSon in a var until it’s implemented :slight_smile:

Well, troubles, I can’t get my syntax to work, but JSon is valid :

{ { "a01":{ "bug":{ "description":{ "0":"Another One !", "1":"At least this one is dead !" }, "interaction":{ "0":"You can't do anything with this.", "1": "No! It's not edible !" } }, "knive":{ "description":{ "0":"A bloody knife lay on the ground.", "1":"Hopefully, it's not my blood." }, "interaction":{ "0":"You looted the knife." } }, "greg":{ "description":{ "0":"It's Greg.", "1":"He looks badly blooded.", "2":"Maybe you could try to wake him up.." }, "interaction":{ "0":"Hey we need to talk!" } } } } }

The syntax is not recognized (symbol + is missing, quote not closed), in action “Parse JSon String”, even if i put the Json in a var…

I tried to replace all double quote by simple quote, but it’s not a solution for me ( texts contains simple quote in sentences). I tried by adding slashes, but nothing work…

What do i miss ?

delete first and last symbol

Nope :frowning: the useless {} (in first and last position) are my fault, it’s added by the forum because i added line break)

Here is the right one, and it still doesn’t work :

{ "a01":{ "bug":{ "description":{ "0":"Another One !", "1":"At least this one is dead !" }, "interaction":{ "0":"You can't do anything with this.", "1": "No! It's not edible !" } }, "knive":{ "description":{ "0":"A bloody knife lay on the ground.", "1":"Hopefully, it's not my blood." }, "interaction":{ "0":"You looted the knife." } }, "greg":{ "description":{ "0":"It's Greg.", "1":"He looks badly blooded.", "2":"Maybe you could try to wake him up.." }, "interaction":{ "0":"Hey we need to talk!" } } } } }

But even like this, “missing symbol+”.