# Talk:Container
Contents

1 slashem polymorph trick
2 Nesting
3 Destroying
4 green goblin
5 sporkhack iron safe
6 Nesting Figures
7 32k items question
8 BUC Status
9 Generation re BUC status
10 Wetting
11 Touchstone?

slashem polymorph trick
Will this anger a shopkeeper, if that is where the ice box happens to be? I'd think yes. Tjr 13:42, 29 April 2009 (UTC)
Does a food store buy ice boxes? Tjr 16:23, 21 May 2009 (UTC)

Nesting
It seems a little strange that chance of an explosion appears to increase after 7 layers. Is this correct? And is it the same for SLASH'EM? MrFroon 20:42, October 14, 2009 (UTC)

It makes sense from a game balance perspective: you could almost eliminate the risk of explosion otherwise. -Tjr 08:02, October 15, 2009 (UTC)
Destroying
Is there any reliable way to destroy boxes and chests? I know you can force with a blunt weapon, but this then relies on failure rather than success (you'd have to keep repairing the lock). This is for the gray stone-in-a-container so polymorph is out.--PeterGFin 10:41, January 11, 2010 (UTC)

To my knowledge, no. If I encounter a gray stone in a container, I will usually either leave it alone or count up my total weight so a loadstone would take me to a different burdoned status than a harmless stone. I have an Excel spreadsheet for this, perhaps I might share it in the future. -Tjr 12:03, January 11, 2010 (UTC)
This reply is a long time away from the original question, but couldn't you just try and lift the container and watch what it does to your Encumbrance to find out if it's a loadstone? --FJH (talk) 00:47, 12 September 2012 (UTC)
That's just what I intended to suggest. --Tjr (talk) 13:57, 12 September 2012 (UTC)
green goblin
should there be some discussion of strategy w/bag of tricks? Just now learning they are basically just another monster generator, I think.

Bags of Tricks make reliable sacrificial generators. They can be a big help if you've found an altar on an early dungeon level but, due to the way the early location of it, monsters don't get generated too often or close enough to the altar. I guess you can use them as pet generators as long as you have a source of taming. --FJH 23:44, October 10, 2010 (UTC)
sporkhack iron safe
I'm playing sporkhack and found an iron safe?  Any1 know anythimg of this?  Should there be something in the article?  There isn't, you know(btw:  The last topic was mine, and I forgot to 4tilde).Slarty 18:00, November 2, 2010 (UTC)

Use a stethoscope or wand of opening to open it.Tjr 18:39, November 2, 2010 (UTC)
Nesting Figures
I just checked with the code and it appearst that the figures for repeated nesting where wrong. If I understand it right, the contents of an object are only checked, if the object itself is not a magic bag or wand of cancellation. So if you put a BoH that already contains another BoH into a third BoH, then the innermost bag does not get an extra chance to cause an explosion.
Zimmi 19:03, 14 January 2011 (UTC)

32k items question
I really don't think that todo belongs in the top of the article - the casual reader isn't going to know how to find the answer to that or be affected much by it.  I think I may have an answer to it, also, but I'd like someone else a little better at coding to verify me.  In pickup.c around line 2118, there's a loop that counts the number of items in the bag:

	for (curr = obj-&gt;cobj; curr; curr = otmp) {

	    otmp = curr-&gt;nobj;

	    if (Is_mbag(obj) &amp;&amp; obj-&gt;cursed &amp;&amp; !rn2(13)) {

		obj_extract_self(curr);

		loss += mbag_item_gone(held, curr);

		used = 1;

	    } else {

		cnt++;

	    }

	}

Now, cnt is earlier defined simply as an int; IIRC this should be 32- or 64-bit depending on your system.  As for obj-&gt;cobj, in obj.h, around line 29, the quantity (quan) of items in it is defined as a long - so it seems the limiting factor would be cnt; of course, you'd have to put 4 billion+ objects in to hit that even on a 32-bit system.  Anyway, does this look correct to people more code-fluent than I? -Ion frigate 10:10, 10 December 2011 (UTC)

In that particular situation, there's no issue with cnt. Even if you did have 4 billion objects, unless you had exactly 4294967296 objects in there you wouldn't have a problem. cnt is only used to check if the bag is empty, nothing else. If you had that exact number of items in a bag it would mistakenly think it was empty (it'd also take forever to discover this; looping up to 4 billion isn't exactly fast), but you could remedy this by putting one more item in.
The real question is in adding items to a bag, as there might be some other bit of code that would break if you exceed 32k or 4 billion. The items in a container are stored in a linked list, which on its own can hold any number of objects until you run out of memory. I can't figure out the exact code used for adding items to bags or taking them out, so there might be something troublesome in there. -- Qazmlpok 13:04, 10 December 2011 (UTC)
BUC Status
There is no mention of any effects caused by BUC status. The BoH does, but not for the other types of containers. So the page doesnt answer the question I have. Can I safely use a cursed chest/box for my stash? I want to curse my stash box and put it on a burned Elbereth so that my pets  and other mobs wont go on the square and pick it up. — Preceding unsigned comment added by 68.204.59.230 (talk • contribs) 

A cursed oilskin sack doesn't always protect items. Other than that and BoH, beautitude of the container has absolutely no impact.
Any cursed item will work to deter pets. Rather than using unholy water to curse the container you could just drop a single unholy water. However this isn't really necessary, if all you want to do is stop pets from picking up the box. Putting another item on top of the box (by simply dropping it on the same square) will make any pet pick up that item instead. And if the box is heavy enough, your pets won't pick it up anyway. -- Qazmlpok (talk) 20:27, 30 June 2012 (UTC)
For very large values of heavy enough, in case you have a pet dragon etc. Stash best practises: You drop the chest, then drop one holy water (for cursed two-handed weapons), then drop a cursed object on top that your autopickup exceptions will never pick up. --Tjr (talk) 21:32, 30 June 2012 (UTC)
Generation re BUC status
The Generation section says "Containers are generated uncursed" but I'm pretty sure BoH can be generated cursed. Does anyone know the relevant source code?
Sauce: I'm currently holding a generated-cursed BoH that didn't come from a bones file. D4 wryyyy (talk) 02:28, 28 July 2021 (UTC)

You can get a cursed bag of holding from a fake bones pile generated on early traps, which can have tools on them. Cursed containers don't generate normally. --Luxidream (talk) 03:12, 28 July 2021 (UTC)
thanks. mind if i quote you? D4 wryyyy (talk) 10:55, 28 July 2021 (UTC)
nvm someone added it. i wasn't sure of the wording D4 wryyyy (talk) 21:02, 28 July 2021 (UTC)
Wetting
The section on wetting says
"If you get into or under the water without wearing an oilskin cloak, only a non-cursed oilskin sack... or a large box completely protects its contents from the water damage." Implying an oilskin cloak does protect carried items from wetting? Afaik it only protects from drowning and from rusting armor. The oilskin cloak page doesn't say anything about items.D4 wryyyy (talk) 06:51, 19 February 2022 (UTC)

Not to mention that list leaves out a greased BoH or sack.
Touchstone?
Is it true that a touchstone cannot be generated in a container?
I see the code that changes rocks into other stones does not allow touchstones or flint stones, but I thought the initial call of mkobj(GEM_CLASS, true) would allow the creation of a touchstone or flint, no? Derekt75 (talk) 20:47, 21 March 2023 (UTC)