K
Kugua
Guest
Hello!
I'm new to gamemaker and still learning the ropes. I've been playing around with managing large amounts of text by saving the text in a csv file, converting to JSON, and then loading the JSON file in the game. Using v2.2.5.378.
The problem I'm running into is that when I load the text, I get "undefined" every time I try to draw strings from it.
To test this, I'm using a super simple JSON file named "text.json" that is just this:
I then print the text in a draw event like this:
I have no issues drawing text from a csv file using similar logic. I've been Googling nonstop, referring to the documentation, and trying various other methods but am still getting "undefined" when I try to draw the string in the JSON file.
I feel like I'm missing something obvious. Can anyone help? It would be greatly appreciated!
I'm new to gamemaker and still learning the ropes. I've been playing around with managing large amounts of text by saving the text in a csv file, converting to JSON, and then loading the JSON file in the game. Using v2.2.5.378.
The problem I'm running into is that when I load the text, I get "undefined" every time I try to draw strings from it.
To test this, I'm using a super simple JSON file named "text.json" that is just this:
Code:
[
{
"ONE": "Hello.",
"TWO": "Hey! How are you doing today?"
}
]
Code:
text_file = json_decode("text.json");
var _print = text_file[? "TWO"];
draw_text(0, 0, _print);
I feel like I'm missing something obvious. Can anyone help? It would be greatly appreciated!