mob
var/tmp/row = 1
var/tmp/col = 1
proc
AddBP(item)
var/obj/O
for(O in winget(src,"backpack.BP","current-cell=[row],[col]"))
if(winget(src,"backpack.BP","current-cell=[row],[col]") == 1)
row++; col++
continue
else
src << output(item,"BP:[row],[col]")
I have this so far, I didn't figure it would work, but I get no errors...any help? Thanks!
Instead of attempting to loop through every cell in the grid just to add an item, you should instead retrieve the grid's <code>cells</code> property to find out how many rows and columns are in it, and then add one to each to get the cell that you want to add the item to.
This isn't a great design, however, since there's no good way to figure out which cell an object is in to remove it. To get around this, you could keep track of the objects added to the grid in a list with their location in the grid or give each a var to keep track of its location.