W
William Lundin
Guest
Hello, so i am new to GML and i am trying to load data from a JSON file into game maker and save that data as variables. I am able to load the data from JSON file, but unable to use the variables?? when i try to add the variables into a ds_list for example, it then throws the error saying "Data structure with index does not exist", and i do not know why. Printing out to the console before works, and it clearly prints the values im loading in, so why is it that i can print out to console using a variable name but not add it to a list?
my code:
my code:
Code:
var json = json_decode(stringg);
var list = ds_map_find_value(json, "Quests");
for(var i = 0; i < ds_list_size(list); i++)
{
var map = ds_list_find_value(list, i);
var ids = ds_map_find_value(map, "id");
show_debug_message(ids); //this prints out perfectly normal, '2' as from the json file
ds_list_add(QuestList(), ids); // If i comment out this line, i get no error on load, but if i leave it
//like this, then it gives error "Data structure with index does not exist" and points to ids variable.
}
Attachments
-
41 KB Views: 25
-
47.2 KB Views: 21
Last edited by a moderator: