Hello guys, I just checked out KidPaddle45's Inventory library and I decided to use the knowledge gained from it and create my own Inventory system. Anyway, I have it somewhat working properly, and by that I mean it displays what its supposed to display and whatnot.
Now, on to the real problem:
I can't figure out how to arrange the items to appear in the proper order, I want it to display starting from the Top-Left of the screen, going horizontally from there on and continue its way all the way to the Bottom-Right.
The way I have it now it displays from the Bottom Left , going up towards the Top Left.
This is the code I'm currently using:
Code:
Inventory
parent_type = /obj
icon = 'Inventory.dmi'
icon_state = "Slot"
var x_Slots = 5
var y_Slots = 5
var Visibility
var isUsed = FALSE
New(visible)
Visibility = visible
if(Visibility == "Show")
winshow(usr,"Inventory",1)
usr.client.screen = null
Show_Inventory()
else if(Visibility == "Hide")
winshow(usr,"Inventory",0)
proc
Show_Inventory()
for(var/X = 1 to x_Slots) for(var/Y = 1 to y_Slots)
var/Inventory/Slots = new
Slots.screen_loc = "Slots:[X],[Y]"
usr.client.screen+=Slots
for(var/obj/Items/Stuff in usr.contents)
src.Add_Items(Stuff)
proc
Add_Items(obj/Items/Stuff)
for(var/Inventory/Slots in usr.client.screen)
if(Slots.isUsed) continue
Stuff.screen_loc = Slots.screen_loc
usr.client.screen += Stuff
Slots.isUsed = TRUE ; return
And this is a screen shot of what's currently happening:
![](http://puu.sh/6y1CF.png)
Obviously point out anything that looks wrong or could use improvement.
-Thanks