Adding a ds grid to a ds_map

Hey guys,

Does anyone know if you can add a ds_grid to a ds_map then save the map and load it back up again and the data be intact.
The problem with this is I have several and would end up with 7 or 8 files. I would like to somehow roll them into one. The ds_map I thought would have been perfect, if it had worked.

Is there any other way I can do it?
You can add as many grids as you like to a single ds map. The ds_*_read/write functions don't transfer the data directly to file, they just convert them between data and strings. You should read about them in the manual
I didn't see that actually I was focused on the ds_map_secure_save function.

I think I'm in the right ballpark now.
Last edited:


I think your problem might be that the map doesn't actually contain the ds_grid - it just contains its index.
So if you'll load it after the ds_grids no longer exists - if you restarted the game, for example - the value that was supposed to contain a ds_grid will just be a meaningless index.

The method I can think of to solve this, and there very well may be better ways, is to store each ds_grid as a ds_list of ds_lists, adding them to the map using ds_map_add_list, and then saving the map using JSON.
You'll also need to use ds_list_mark_as_list for the ds_lists within the ds_lists representing the ds_grids.

Then, if necessary, you can add functionality when you load them to turn the ds_lists back to ds_grids.

Edit: Okay, What stainedofmind is suggesting is better. Convert each ds_grid to a string using ds_grid_write and add those strings to the ds_map, not the indexes.
Last edited:


Could you guys help me with writing this the correct way? I understand what you are saying but I have troubles implementing it.
Is there anything wrong with:

ds_map_add(_Map, "InventoryBox", ds_grid_write(Box))
ds_grid_read(Box, _Map[? "InventoryBox"])
it doesn't seem to be working for me...

Box is being created previously like
Box = ds_grid_create(Width, Height)