ID:155300
 
How i can save a grid content on the savefile?
Loop through the cells in the grid and write it's contents to the savefile.
In response to Pirion
Pirion wrote:
Loop through the cells in the grid and write it's contents to the savefile.

I've done anything like that on the save,but i'm
having troubles on the loading,cuz i didn't know how
to put the items on the grid.
In response to Nakano15
src << output(object,grid)
In response to Pirion
Pirion wrote:
src << output(object,grid)

But the item is an atom.
In response to Nakano15
It would still work if it was an atom, problem is you should store the data that should be saved in a list because I'm pretty sure you can't read (as in use winget to get information from) a grid.
In response to ExPixel
ExPixel wrote:
It would still work if it was an atom, problem is you should store the data that should be saved in a list because I'm pretty sure you can't read (as in use winget to get information from) a grid.

I've done this to the save and load game.

Savegame
            var/i = 1
while(i <= 100)
for(var/Item/I in contents)
F["i_item[i]"] << output("[I]","inv:1,[i]")
F["i_amount[i]"] << output("[I]","inv:2,[i]")
usr << "Saved item line [i]."
i += 1


Loadgame
            var/i = 1
var/item
var/amount
while(i <= 100)
F["i_item[i]"] >> item
F["i_amount[i]"] >> amount
src << output("[item]","inv:1,[i]")
src << output("[amount]","inv:2,[i]")
src << "Item [i] loaded."
i += 1


But look's like it's ignoring those lines.cuz in both of them,not show the "Item [i] loaded.".
In response to Nakano15
check the output of the load, i bet its not what you expect...
In response to Pirion
Pirion wrote:
check the output of the load, i bet its not what you expect...

No,i didn't seen anything wrong.