ID:165321
 
My inventory still doesn't work, when i want something to happen when you click things in the statpanel. i tried making a list called inventory but that only puts whatever you "Get()" in your inventory, which you then instantly delete with "del(src)" anyway so it's basically useless. HELP!
There's already a built in "inventory" called contents(ex. usr.contents += object); so you don't have to make a list..Could you explain the rest of it better? 0_0
Adam753 wrote:
i tried making a list called inventory but that only puts whatever you "Get()" in your inventory, which you then instantly delete with "del(src)" anyway so it's basically useless.

I'm not sure where this started, but I've seen it many times. Instead of deleting and creating a new item in Get(), you should just Move() the item to the player.

obj/item/proc/get()
set src in oview(1)
if(Move(usr))
usr << "You got [src]."
In response to YMIHere
erm... are you sure you want the Move() bit in a conditional? i'm not too sure but i'll try it.
(sorry i haven't been reading this)
In response to Adam753
By default, Move() returns TRUE when succesful. This way if for some reason the object doesn't move, no confimation will be sent. =)
In response to Adam753
Okay, this ALMOST WORKS, but as i just realised, when you click Get(),the item doesn't go away. It follows you around, though it is invisible and not exactly "there", so the Get() verb never goes away.
In response to Adam753
src should be set in oview(), I imagine you set it in view(). Also, for some reason I defined get() as a proc, it should be a verb. =)
In response to YMIHere
YMIHere wrote:
src should be set in oview(), I imagine you set it in view(). Also, for some reason I defined get() as a proc, it should be a verb. =)
Hold on... so oview does what, exactly? i was always told it meant view, exept the src's current loc. so oview(10) would be view(10) except for the spot src is standing in. But anyway, that works fine, thanks!
In response to Adam753
oview() is the same as view without the center (which us usr, by default) or it's contents.
In response to YMIHere
Uhh... actually, i just noticed something else: This mucks up my Buy() verb. how would i make it so that when you Buy() you get a switch(input()) for a list of things to buy, then when you choose, you get the item in usr.contents. i've tried a few things that seemede to make sense but for some reason i get the SHOPKEEPER in my contents!