king javo
Member
I'm trying to load a json file using the below code and I don't understand where to place the file while running the game in GMS2's IDE. The working_directory variable seems to be looking in the \AppData\Local\GameMakerStudio2\GMS2TEMP but every time I run the project it creates a new folder inside of here and this is where it's looking.
Am I missing something? Also, when trying to use json_decode(string) using a valid json text block, the GMS2 throws an error not liking the string. Anyone have a clue why this works in GMS1.4 and not GMS2?
Example json below...
Am I missing something? Also, when trying to use json_decode(string) using a valid json text block, the GMS2 throws an error not liking the string. Anyone have a clue why this works in GMS1.4 and not GMS2?
Code:
show_message(working_directory);
if(file_exists(working_directory + "\teams.json")) {
show_message("Found save file!");
var jsonFile = file_text_read_string(working_directory + "\teams.json");
return json_decode(jsonFile);
}
else
{
show_message("Found no save file!");
}
Code:
///get_class_data()
// This may end up in an external file, for now it is here
return json_decode('
{
"teams": {
"id": 0
}
}');
Last edited: