ID:1865665
 
(See the best response by Kaiochao.)
Problem description: I could probably go to him directly but it seems as if he doesn't update this demo anymore. But anyway, the issue is in the demo, when you open up the inventory he sets client.screen to null. The major issue with this obviously any HUD objects you have on screen go too.

I'm asking is there alternative way just to clear the inventory window?

// his code
mob/verb/Inventory()
winshow(src,"Inventory",1) //Show the inventory window!
var/Position = winget(src, "default", "pos") // Get the position of the "default" window and assign it to a var called "Position"
winset(src,"Inventory","pos='[Position]'") // Set the position of the "Inventory" window to the same position as our main window.
src.client.screen = null //Clear the inventory before generating everything inside.
for(var/Column = 1 to 5) for(var/Row = 1 to 5) //Create a grid composed of 5 columns and 5 rows.
var/Grid/G = new
G.screen_loc = "Inv:[Row],[Column]"
src.client.screen += G
for(var/obj/items/I in src.contents) src.AddItems(I)



Best response
Yeah, you add those Grid objects to a list, then just subtract that list from client.screen.
Look about right?

var
inventory_list = new/list()

mob/verb/Inventory()
winshow(src,"Inventory",1) //Show the inventory window!
var/Position
if(last_position)
Position = last_position
else
Position = winget(src, "default", "pos") // Get the position of the "default" window and assign it to a var called "Position"
winset(src,"Inventory","pos='[Position]'") // Set the position of the "Inventory" window to the same position as our main window.

src.client.screen -= inventory_list
inventory_list = initial(inventory_list)

for(var/Column = 1 to 5) for(var/Row = 1 to 5) //Create a grid composed of 5 columns and 5 rows.
var/Grid/G = new

G.screen_loc = "Inv:[Row],[Column]"
src.client.screen += G
inventory_list += G

for(var/obj/I in src.contents)
inventory_list += I
src.AddItems(I)
In response to Rickoshay
I don't think initial() will work. You can just do "len = 0" or "inventory_list = new" or "inventory_list.Cut()" (but then you'd have to declare your variable as a list). I also suggest that you define it under /mob or /client so that everyone keeps track of their own set of things.
Alright, Thanks for the info Kaiochao.
initial() doesn't work with lists that are set at compile-time, because they're not literally created at compile-time.

Whenever you have something like this:

mob/var
inventory_list = new/list()

...two undesirable things happen. First, that list is being initiated for every mob, whether they need it or not. Second, it's initiated in a special init proc that has no name.

If this is a global var instead, the same thing happens but it takes place around the time of world/New(). I don't think either of the above concerns are a problem for global vars, but initial() still won't work in this case.

Inside Dream Maker, compile-time vars that are set to values that won't exist until runtime end up as a special "expression" type that only is meaningful to the build code. Eventually I'd like to change this to make sure they save as something reasonable instead, but even then I'm not sure initial() could be made to work.