TheNegroShoddy
Member
I'm about to start writing the save/load system for my game using ds_maps and was wondering how I'd add an entire ds_list to a ds_map? The documentation says to use ds_map_write to store the list as a string and ds_map_read to transfer it to another data structure, but I'm getting this error when I run my code:
Why is it saying its expecting a string, but I thought using ds_list_write returns a string...?
EDIT: Opps! I forgot the id! Which is why I'm getting the error.
Still want to know if I'm going about this the right way though.
Code:
############################################################################################
FATAL ERROR in
action number 10
of Create Event
for object game_initializer_obj:
ds_list_read argument 2 incorrect type (16777215) expecting a String (YYGS)
at gml_Object_game_initializer_obj_CreateEvent_10 (line 8) - ds_map_add( global.save_data, "Deck List 1", ds_list_read( decklist1_str ) );
############################################################################################
Code:
var decklist1_str = ds_list_write( global.deck1_list ); // Get the list of cards in the deck as a string
ds_map_add( global.save_data, "Deck List 1", ds_list_read( decklist1_str ) ); // Add the string to the ds_map
EDIT: Opps! I forgot the id! Which is why I'm getting the error.
Code:
var decklist1_str = ds_list_write( global.deck1_list ); // Get the list of cards in the deck as a string
ds_map_add( global.save_data, "Deck List 1", ds_list_read( global.deck1_list, decklist1_str ) ); // Add the string to the ds_map
Last edited: