ID:264826
 
Code:
UpdateInventory()
var/items = 0
src.viewer = "Inventory"
for(var/obj/Spell_HUD/Spell_Slot/S in src.contents)
del S
for(var/obj/O in src.contents)
winset(src, "inventory", "current-cell=1,[++items]")
src << output(O, "inventory")
winset(src, "inventory", "current-cell=2,[items]")
src << output("[O.count]", "inventory")
winset(src, "inventory", "cells=2x[items]") // cut off any remaining cells


Problem description:
I'm having an issue trying to get the grid to display both an object and the amount of them you have in the same grid. I can get it to either display all of your inventory, or the amount you have of each, but not both. I'm sure I'm just not doing this correctly, so what do I need to change?

Thanks in advance.
What you've written should work, though I'd suggest not using winset() to change current-cell, and instead outputting to "inventory:1,[++items]" and "inventory:2,[items]", which is more convenient.

My guess is that your grid is set to be a "flexible list of entries", which won't work here.
In response to Garthor
Ah ok, I can't set it to a flexible list while having 2 different types of contents, or is there something more to it?
In response to Pyro_dragons
A flexible list is one-dimensional. You could perhaps cheese it with a bit of futzing around but, really, just uncheck that box and what you have should work.
In response to Garthor
Oh ok. I thought I could adjust the dimensions on it as well. Thanks for clearing that up. Despite how long I've been here, just now getting to learn the interface stuff.