Is it possible to use text from a JSON file as an input?
(note when i say input i mean something like this
) the game im making is going to rely on this heavily, and im not very god at java script
As JSON is a key-value text pair, you’ll need to load and convert the JSON file into a structure. Then you can access the values by using the key (or name of the structure’s child).
So say the file is GameSave.json, with contents:
{ "name":"MrMen", "hitpoints":"100" }
Then you’d use the events as:
Thanks, just one thing,
have a file like this, and i want to have it as an expresion so i an use the text manipulation stuff
idk if i can even do this with a JSON, but it will be necessary for what im trying to make
You can, but you need to figure out what the keys are for each line of dialogue. Usually it’d be a word that identifies what the dialogue is used for or where it is used.
i made a json that is formatted correctly and has everything i need in it. the only problem i have left is that i need to make an expression where i can select which object i want and what key i want as an expression.
I dont know how to do any of that.
ive google tutorials abd stuff but i couldent find what I was looking for
Why have you used square parenthesis (“[” & “]”)? This makes the children an array… Get rid of them, and you can access to structure properly, like StructureVariableName["1"].charN
(assuming you have loaded the data as per one my earlier post).