F
FloresSottile
Guest
I've noticed that ds maps won't store childs with their full data if they are being cleared out from outside. So I was wondering if there's anyway to iteratively nest maps into a one big map so I can export all the data in JSON once the game is over (it's for statistical research so I need absolutely everything stored).
So I did this little test to store nested maps and I have no problem with it, but If I wanted to do this iteratively I know the variable storing the actual map saving the round (the game has rounds with waves) data will be a problem:
Is there anyway I could do this iteratively and then output the whole JSON format string with all the data without having to lose what my child maps stored?
Thanks in advance.
So I did this little test to store nested maps and I have no problem with it, but If I wanted to do this iteratively I know the variable storing the actual map saving the round (the game has rounds with waves) data will be a problem:
Code:
myMainMap = ds_map_create();
myOtherMap1 = ds_map_create();
myOtherMap2 = ds_map_create();
myOtherMap3 = ds_map_create();
ds_map_add(myOtherMap1, "multiploA", 5);
ds_map_add(myOtherMap1, "multiploB", 2);
ds_map_add(myOtherMap1, "resultado", 10);
ds_map_add(myOtherMap1, "respuesta", 10);
ds_map_add(myOtherMap1, "tiempo", 5);
ds_map_add_map(myMainMap, "1", myOtherMap1);
ds_map_add(myOtherMap2, "multiploA", 2);
ds_map_add(myOtherMap2, "multiploB", 4);
ds_map_add(myOtherMap2, "resultado", 8);
ds_map_add(myOtherMap2, "respuesta", 8);
ds_map_add(myOtherMap2, "tiempo", 5);;
ds_map_add_map(myMainMap, "2", myOtherMap2);
ds_map_add(myOtherMap3, "multiploA", 6);
ds_map_add(myOtherMap3, "multiploB", 7);
ds_map_add(myOtherMap3, "resultado", 42);
ds_map_add(myOtherMap3, "respuesta", 48);
ds_map_add(myOtherMap3, "tiempo", 5);
ds_map_add_map(myMainMap, "3", myOtherMap3);
var salidaJson = json_encode(myMainMap);
show_debug_message(salidaJson);
Thanks in advance.