ID:147161
 
mob/var/list/inventory = list()
mob/verb/Pick_Up(obj/O as obj in view(1,usr))
set name = "Pick Up"
usr.inventory += O
del O // I think this part right here probaly deletes the object when it's in the user's inventory. Not sure



Problem: I pick up an object without del O and the object ends up in my inventory, except the object in view() still remains. With del O the object is deleted on the field and the object doesn't appear in the inventory.
ZLegend wrote:
mob/var/list/inventory = list()
> mob/verb/Pick_Up(obj/O as obj in view(1,usr))
> set name = "Pick Up"
> usr.inventory += O
> del O

Problem: I pick up an object without del O and the object ends up in my inventory, except the object in view() still remains. With del O the object is deleted on the field and the object doesn't appear in the inventory.

Instead of deleting the object, try setting its location to null. That way it won't appear on the map, but will be in the player's inventory.

If you're not using the player's contents variable for anything, why not just use that?
In response to Jon88
Is it a crime to experiment? =P

And why would you want the Pick_Up verb to include items already in your inventory?
mob/verb/Pick_Up(obj/O as obj in view(1,usr))

First error is there. You want oview(), which will exclude yourself, and, more importantly, everything you're carrying.

Your second error is when you didn't simply use O.Move(usr).

Even better: if(O.Move(usr)) usr << "You pick up [O]"
In response to Garthor
what would Move have to do with adding O to your inventory. From what looks like on the Reference, it looks like it has nothing to do with this.
In response to ZLegend
If you Move() something into an atom, that something is now located in the atom. It's also an item in the atom's contents variable.