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 7) //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/I in src.contents) src.AddItems(I) //Generate the items on slots.
for(var/Column = 1 to 3) for(var/Row = 1 to 3) //Create a grid composed of 5 columns and 5 rows.
var/Grid/G = new
G.screen_loc = "eqp:[Row],[Column]"
src.client.screen += G
mob/proc/AddItems(obj/I)
for(var/Grid/G in src.client.screen)
if(G.used) continue
if(!I.screen_loc) //only set if it doesn't have a screen location.
//if picking up a new object, you'll want to set it to null
I.screen_loc = G.screen_loc
src.client.screen+=I
G.used =1
return
obj/items
MouseDrag()// When we drag it...
var/obj/O = src
var/icon/I = new(src.icon,src.icon_state)//this is so the cursor icon transforms into the item itself...cool little effect.
mouse_drag_pointer = I // now lets set the mouse cursor to that.
if(O.screen_loc=="inv:1,1")
usr << "Testing"
Problem description:
I'm having troubles trying to figure out how to refer to an objects original location when using the MouseDrag(). I'd like to get it to be able to change a variable once the object has been moved, dependant on what the frst location of the object was. Such as in the example above, "inv:1,1" being the start.
(I did not write all of this code, and in no way claim it to my self.)
Dragging the object doesn't change the object's original position. Nor does dropping it. In other words, the item's original location will be the same location as when it started, when MouseDrop() is called.