Inform does make it genuinely difficult to hide things in situ in a watertight manner.
I think the concealment relation was intended to hide things from the player ‘as if they weren’t even there’ but, as you obliquely suggest, if the player is somehow able to take direct or indirect possession of a concealed item it will show up in inventory. This is perhaps the only way a concealed item differs from one removed from play in it’s degree of ‘hiddenness’. It’s easy to tweak the inventory listing rule so that it doesn’t list concealed things (and, by extension, their contents):
The print empty inventory rule is not listed in any rulebook.
The print standard inventory rule is not listed in any rulebook.
Carry out taking inventory (this is the hide indirectly held concealed things inventory rule):
if the player has a described not scenery thing:
say "[We] [are] carrying:[line break]" (A);
[Setting the 'not listing concealed items' option for the list writer will (paradoxically) not suppress DIRECTLY held concealed items (and, by extension their contents) - although it will suppress directly held undescribed and scenery items. We use the possession relation ('has') to exclude thing incorporated by the player]
list the contents of the player, with newlines, indented, including contents, giving inventory information, not listing concealed items, with extra indentation;
otherwise:
say "[We] [are] empty-handed" (B);
but direct possessions that the player themself conceals- from others, but evidently not from themself- (and by extension, their contents) will still be listed. That shouldn’t be a practical issue because things are concealed by their holder, so if the player takes the holder into their possession the concealed item(s) are not direct possessions and will be suppressed from an inventory listing ‘tweaked’ not to list concealed things. Furthermore, it’s probably desirable that directly-held concealed items are not suppressed from inventory (although directly-held scenery and undescribed items are). With respect to the latter, it’s generally only when taking inventory on the first turn that undescribed items get the chance to be suppressed from inventory, as any undescribed items enclosed by the player are made described at the end of each turn.
It’s not too difficult to take matters one step further and suppress even directly-held concealed items from inventory- although this still leaves them in scope (for the player, not for NPCs):
The print empty inventory rule is not listed in any rulebook.
The print standard inventory rule is not listed in any rulebook.
Carry out taking inventory (this is the hide all concealed things inventory rule):
if the player has a described unconcealed not scenery thing:
say "[We] [are] carrying:[line break]" (A);
now all things enclosed by the player are unmarked for listing;
now all unconcealed described not scenery things had by the player are marked for listing; [To suppress ALL concealed items we need to use 'marked for listing' because setting the 'not listing concealed items' option for the list writer will (paradoxically) not suppress DIRECTLY held concealed items (and, by extension their contents) - although it will suppress directly held undescribed and scenery items. We use the possession relation ('has/had') to exclude from consideration things incorporated by the player]
list the contents of the player, listing marked items only, with newlines, indented, including contents, giving inventory information, not listing concealed items, with extra indentation;
otherwise:
say "[We] [are] empty-handed" (B);
It’s instructional to list the standard rule as well as both alternative rules, so that all three produce output, and compare what is shown when things directly or indirectly held by the player are concealed, and/or undescribed and/or scenery.
Notable is that all things enclosed by a person who is themselves enclosed by the player (e.g. the direct and indirect possessions of a monkey carried by the player) are never listed, neither is anything which is a part of something, or anything enclosed by that part. This is because the subroutine the list-writer uses to list the contents of something (through the ‘including contents’ phrase option) only does so for containers and supporters and doesn’t consider parts at all. The only worn and carried things listed therefore are the direct possessions of the player. Similarly, if you illicitly move something through code to a possession of the player that is not a person, container or supporter that something will not appear in inventory.
So a fairly full answer to the oft-asked question ‘How do I stop something from appearing in inventory?’ might be:
- move it off-stage (or at least somewhere beyond the player’s scope ceiling) until it’s needed
- make it a part of the player or a part of something the player encloses
- move it to a person enclosed by the player
- move it to a supporter/container that is a part of something else enclosed by the player
- move it (illicitly through code) to something enclosed by the player that is none of person, container or supporter
- make it scenery or concealed and tweak the ‘carry out taking inventory rule’ to suppress concealed things
- write a custom ‘carry out taking inventory rule’ that specifically excludes that item (or a description of items)
To also keep said item out of scope and invisible:
- move it off-stage (or at least somewhere beyond the player’s scope ceiling)
- make it concealed (by something other than the player) or inside something concealed (by something other than the player)
- move it to a closed opaque container enclosed by the player
- move it (illicitly through code) to something opaque enclosed by the player that is none of person, container or supporter
Note that the immediate possessions of the player are ALWAYS in scope to the player- this is a basic tenet of the scope model not easy to circumvent without some minor I6 hacking. I7 makes it easy to directly add objects to scope, but not to remove them.
All these 4 manoeuvres will also
(i) prevent the hidden item being discovered should its (purported) holder be examined or searched. To allow discovery, the author must (if desired) supply code to remove or circumvent the method of hiding if these actions are taking (or have taken) place. However, a (readily fixable) bug currently causes concealing supporters or containers with no unconcealed contents to hint at their secret when their contents are listed (e.g. when examining) by announcing that on or in them is ‘nothing’. To work around this, either apply a fix for the bug or place an immovable unconcealed object on or in said supporter or container.
(ii) prevent the hidden item being included in ‘all’ for commands such as ‘take all’ (unless the command invokes a grammar token that bypasses scope, such as [any things], in which case making the hidden item undescribed will block this too- albeit this won’t work for things enclosed by the player)
(iii) prevent the hidden item being included in disambiguation questions (an object must be in scope to get as far as being included in a disambiguation list)
In most instances- although it may offend against the author’s sense of simulation- the well-established quick-and-dirty route is to completely hide objects by moving them to nowhere or to a ‘limbo room’ with no map connections.
In edge cases where this is not possible or undesirable (e.g. the inbuilt Inform door kind, which can’t be moved around, or when testing for the presence of the item in a specified room or other place is highly desirable) the other methods may be useful. A workaround for keeping objects off-stage while retaining the ability to easily check their ‘true position’ and/or return them to it, when their ‘true position’ is not fixed, is to give them a property that can be checked (called ‘true-position’ or similar), which is given the value of the ‘true’ holder of the object when they are moved off-stage.
The main advantage of the concealment option (apart from it not feeling like a ‘hack’) is that, being rule-based, it it very easy to set the conditions whereby the object is hidden or not, particularly if these are complex and changeable.
Other options are likely to be useful mainly when it is desirable for the hidden object to remain in scope.
In the index case that started this thread, the pocket as a part of the coat is perhaps a somewhat unnecessary complication unless it is required as an ongoing facility for things to be put into and taken out of. The standard very-quick-and-dirty approach would be to keep the ticket off-stage until the player examines or searches the coat and have an ‘Instead rule’ that announces the discovery, moves the ticket to the player’s possession and politely blocks further examination with ‘The pockets of the coat are empty.’, perhaps with another rule politely dissuading the player from trying to insert things into the (unsimulated) pocket. Having the pocket as an ongoing facility is a nice simulationist touch however, so I guess you pays your money and takes your choice on that.