adv3Lite: Looking in a Container

I have a closed, transparent Container (a Fixture) in which is something I don’t want to be shown in the room description. Therefore, I’ve defined the thing in the container as a Fixture. It’s never going to be moved, so that part is okay. The trouble is, once the container has been opened, it needs to be searched. The LookIn action (to which Search remaps) ignores Fixtures.

How do I get the stuff in the container to show up in response to LookIn, while still being omitted in the normal room description? I can’t just give the container my own lookInMsg, because the silly player might put other stuff in the container, all of which would need to be listed in response to ‘look in’. Of course, I could prevent the player from putting anything new into the container, but that’s sort of a brute-force solution, and might later turn out to be problematical for other reasons.

On the item that is in the container, set isListed = nil then put the following in the shoppingBag object…

dobjFor(LookIn) { action() { if(loafOfBread.isIn(shoppingBag)) { loafOfBread.isListed = true; inherited; loafOfBread.isListed = nil; } else inherited; } }

This will make the isListed property true during the brief moment the game engine is constructing the output text for the LookIn command, then it will reset isListed back to nil.

There is one problem that will still have to be resolved, but you’ll probably have to resolve this no matter what you do. If you do a Look command for the room, the container will be listed, along with all of the things that the user may have put into it, but not the loaf of bread.

For example, say the container is your shopping bag, your unlisted item is the loaf of bread, and the game player has added a jar of mustard.

A look command for the room will there is a bag with a jar of mustard, but a look in bag command will say it contains a jar of mustard and a loaf of bread.

That may or may not be what you want; it so, then you’re good to go. if not, then you will have to do some more word juggling, possibly in a dobjFor(Look) on the room.


The more straightforward way to tackle it, if I understand what Jim is trying to do correctly, is simply to define searchListed = true on the Fixture in the transparent container, e.g.:

+ bowl: OpenableContainer 'large glass bowl'
    transparent = true

++ Fixture 'hidden object'
    searchListed = true

Well, I guess that’s what gave rise to the acronym KISS—keep it simple, stupid. Doh!

However, you do also have to have both isListed = nil and searchListed = true on the hidden object; searchListed = true alone won’t do it.


I think you’ll find I took care of that by making the hidden object a Fixture, for which isListed is already nil (since Fixture defines isFixed as true and Thing, from which it inherits isListed, defines isListed as !isFixed).