joelmayer as mentioned above we aim to do the documentation for new features when the following stable release comes out.
As a pure data format JSON is much nicer and a lot more flexible than CSV, and isn't too hard to work with. You may find it easier in the long term to just rewrite your dialog file in the JSON format instead of converting it from CSV.
all references to arrays here are talking about JSON arrays, not the array plugin
Crash course in JSON
JSON is structured similar to how you would think of folders and files. There are 2 types of "folder"; arrays and objects. You start an arrays use square brackets and an object with a curly braces. Arrays have no label, so you access their contents by index. Objects have a label for each "file", these labels are strings. You can put any type of "file" or "folder" in any "folder". Every "file" or "folder" in JSON has a unique path that you can access it with.
Crash course in JSON plugin
If your trying to read data the first thing you want to do load it in. Get your data with the AJAX plugin and use the JSON.Parse action to load it into the plugin. If it's not valid JSON the on parse error condition will trigger, otherwise your ready to go.
If you know the path of the "file" you want you can just get the data using the JSON.Get expression. You can make a path by joining the names of the "folders" with a full stop. As arrays don't have names for their contents you can use a number like so "data.enemies.3.name".
It can get a bit tedious writing the full path all the time, so you can move your current location using the SetPath action. Now if you start your path with a full stop it will be relative to the current location. Paths that don't start with a full stop will be absolute paths and ignore the current location.
Working with arrays you might not know how many entries there are, so you can use the ArraySize expression to find out. Also there is a foreachcondition that loops over "folders". Inside the loop you can use the CurrentKey expression to get the label and CurrentValue to get the value.
I'm not going to cover it here but the plugin also has methods of creating and modifying JSON data.
Putting this together
Say you have a series of named dialogs, each having a title and a few pages of text you could have something like:
{
"welcome": {
"dialog-title": "Welcome",
"pages": [
"Hello new player",
"welcome to my game",
"I hope you enjoy it"
]
},
"gameover": {
"dialog-title": "Game Over",
"pages": [
"You seemed to have died",
"Maybe you should try again?",
"Or you know, go look at a tree or something"
]
}
}
Then in you can have an function for "show dialog" that just takes the name of the dialog and do:
System | Set DialogName to Function.Param(0)
JSON | Set path to DialogName
Title | Set text to JSON.Get(".dialog-title")
JSON | Set path to ".pages"
// some magic here to increment through the pages
System | set PageCount to JSON.ArraySize(".")
Content | Set text to JSON.Get("." & PageNumber)