J
Jahasaja
Guest
Hi all,
I have figured out how to do saving and loading for a position within a ds_list with the help of Shaun Spaldings excellent tutorial
Saving to position 0
Loading from position 0
However, if possible I want to be able to both load from a position within the DS_list and also create a DS_list "sub_root_list" within this "root_list" and load from that one using:
I just do not seem to be able to figure out how to create a ds_list within the ds_list and then loading from it.
Thankful for any help..
I have figured out how to do saving and loading for a position within a ds_list with the help of Shaun Spaldings excellent tutorial
Saving to position 0
Code:
var _root_list = ds_list_create();
var _map_player = ds_map_create();
ds_list_add(_root_list, _map_player);
ds_list_mark_as_map(_root_list, 0);
//Wrap the root LIST up in a MAP!
var _wrapper = ds_map_create();
ds_map_add_list(_wrapper, "ROOT", _root_list);
//Save all of this to a string
var _string = json_encode(_wrapper);
SaveStringtoFile("savedgame.sav", _string);
//Nuke the data
ds_map_destroy(_wrapper);
Loading from position 0
Code:
var _wrapper = LoadJSONFromFile("savedgame.sav");
var _list = _wrapper[? "ROOT"];
var _map_player = ds_list_find_value(_list,0)
Code:
for (var i = 0; i < ds_list_size(_list); i++)
Thankful for any help..