ID:150404
 
Since I am having such difficulty with listing items stored in a container, I have opted for a different way of handling the inventory in my game.

To put it simply, when you put an item in a bag, the item's suffix is changed to the name of the bag. To avoid confusion, when you buy a bag, you are given a 1 use verb, label, to allow you to change the name of your backpack. Thus, if you have 2 or even 3 backpacks, they will each have a different name, like pack 1, pack 2, and pack 3.

With this system, when you put an item in a pack, you know which specific one it is in.

Here is the problem though. How do I make it so that when you drop pack 1, all items in your inventory with the suffix "pack 1" get dropped also?
Kidknee wrote:

Here is the problem though. How do I make it so that when you drop pack 1, all items in your inventory with the suffix "pack 1" get dropped also?

Cycle through the user's contents, checking for a match between each object's suffix and the pack's name. If there is a match, drop that object.

The only problem is that the items will drop, but appear outside the bag. However, I think this just points out the limitations of your idea. I'm not sure why you abandoned having the objects actually contain each other. Seems like that was the way to go to me.
In response to Skysaw
Because I cant get the items to display their contents.

I use usr << src.contents, and all it ever shows in the text window is /list
In response to Kidknee
Kidknee wrote:
Because I cant get the items to display their contents.

I use usr << src.contents, and all it ever shows in the text window is /list

That's because src.contents is a list. Try looping through that list, and sending each item to the user. Should look something like this:

for(var/obj/O in src.contents)
usr << O
In response to Skysaw
Or, alert it.

I would disp() it, but then, that's part of my special LoW Lib()