ID:180164
 
First off, here's the problem code:

obj/container/chest
verb
put(obj/O as obj in usr.contents)
set name = "Put"
set src in view(1)
if(O.Move(src.contents))
usr << "You put the [O.alt] in the [src.name]."
oview() << "[usr.name] puts \a [O.alt] in the [src.name]."
else
usr << "You cannot put the [O.alt] in the [src.name]."


Now, I can't figure out why but whenever I use the put verb to try to put something into the chest, it always returns the "else", and I can't figure out what's preventing it from going in. It's probably just a dumb overlook on my part, but if anyone can spot it for me or show me what I did wrong I'd appreciate it.
Foomer wrote:
First off, here's the problem code:
<FONT COLOR=silver>
obj/container/chest
verb
put(obj/O as obj in usr.contents)
set name = "Put"
set src in view(1)
if(O.Move(src.contents))</font>

Here's the problem. You want to have O.Move(src). Things can only be moved into atoms (Area/Turf/Obj/Mob). src.contents is a list, not an atom. I can see how you thought you could do that since once the object is moved in there, it shows up in the contents list. You can add something to the contents list, but you can't move something into it that way.
In response to Air Mapster (#1)
Air Mapster wrote:
Foomer wrote:
First off, here's the problem code:
<FONT COLOR=silver>
obj/container/chest
verb
put(obj/O as obj in usr.contents)
set name = "Put"
set src in view(1)
if(O.Move(src.contents))</font>

Here's the problem. You want to have O.Move(src). Things can only be moved into atoms (Area/Turf/Obj/Mob). src.contents is a list, not an atom. I can see how you thought you could do that since once the object is moved in there, it shows up in the contents list. You can add something to the contents list, but you can't move something into it that way.

Hey, it works too! I just feel more and more ignorant every day :o) Good to know. Thanks.