Hello everyone,
I was searching for a solution to create a dialogue system that will be included in various adventure games / rpg's. And decided to purchase the C2 data editor to do the leg work, and it's awesome!
But, I'm having a complete blank moment, and have gotten a bit stuck with how to deal with accessing the nested data within the structure (in this instance, an array of strings that sit inside a conversation object).
Now some of the helper functions are useful in that they return certain row numbers based on your query, so that's great. But the main problem is what to do after that really.
For example (apologies if it looks a bit messy):
{
"c2array": true,
"size": [2, 2, 1],
"data": [
[
[1],
["{\"c2array\":true,\"firstRowIsColumnNames\":true,\"size\":[4,2,1],\"data\":[[[\"belongsTo\"],[\"str\"]],[[\"player\"],[\"Hi, I don't suppose you have any materia?\"]],[[\"npc\"],[\"Er, we're fresh out actually. But feel free to take a look anyway.\"]],[[\"player\"],[\"Oh, ok. Let's see what you have.\"]]]}"]
],
[
[2],
["{\"c2array\":true,\"firstRowIsColumnNames\":true,\"size\":[1,2,1],\"data\":[[[\"belongsTo\"],[\"str\"]]]}"]
]
]
}
[/code:3334wj70]
Here I'd like to access the first set of data in the c2array, and, from within that, access each individual string. You might notice the 'belongsTo' property, that's basically where I want to end up.
So my conclusion was to store that nested data within a different array, then I can cycle through it and show it on the page using the array.at() expression.
But, my struggle comes when making the link between the JSON string, and then getting that sub data in to an array to access...
Hope this all makes sense, thanks for your time!