Contained object blocking description for object in room

I have rations in my backpack. There are also rations for sale in the current location: Ganon’s Emporium. If I try to examine any (unique) thing I own or anything in the room, all works fine. However, if I try to examine rations contained in my player’s backpack, then it can’t find that object. It doesn’t bother checking for the rations in the room.

A backpack, lantern, oil, rations, rope, tinderbox, torch, and skein are scenery in Ganon’s Emporium. My player is also carrying rations in the backpack being carried.

How do I get past the “can’t see any such thing” error response? It doesn’t make any difference if the rations are scenery or an object in the room.

Does examining them work normally in another location?

1 Like

That sounds like odd behavior - can you post a code excerpt that demonstrates what’s happening?

1 Like

Yes, I was thinking along these lines.

Is it possible that you have two synonyms in one place? LIke your backpack’s rations could be coded understand “food” as rations and then Ganon’s rations are understand “food” as rations. Something along those lines?

The coding really would help :slight_smile:

Good suggestions. I didn’t post the code because it extends throughout the source file. I’ll look for those ideas and if I don’t find the problem, I’ll put the relevant source code up.

Matt’s suggestion is the closest to what I found.
Player carries a backpack that contains a tinderbox and rations.
SHOWME PACK gives its proper contents.
I also have a backpack in the Emporium, which contains nothing. When I ask
OPEN PACK
apparently it open the Emporium’s pack, which contains nothing, and I get the
response:

I think that the location object is acted on first (as it should) but I need a way to distinguish between the two packs but have the same description etc.

Here’s the code:

A backpack is a container. Backpack is openable and closed.
Description of backpack is "A small traveling pack that you wear on your back. It is made of leather with many pockets. It also has a few loops for attaching other things."
Understand "pack" as backpack. 

rations are edible. Rations has a number called nbrMeals. nbrMeals of rations is 3.  [CONSTANT]
Description of rations is "Some dried jerky and other foodstuffs are wrapped in a cloth. You have enough for [nbrMeals] meals.".
Printed name of rations is "rations ([nbrMeals] meals)".
Understand "jerky/meals" as rations.

[In Ganon's Emporium is the statement:]
A backpack, lantern, oil, rations, rope, tinderbox, torch, and skein are scenery in Ganon's Emporium. 

[This is called when character is generated.]
To fill starter kit:
	[All players get the same class-independent equipment.]
	now player is wearing clothing;
	now player carries a backpack;
	now player carries a skein;
	now the fullness of the skein is brimming;
	now player carries a small belt pouch; 
	now tinderbox is in the backpack;
	now rations is in the backpack;

Sidenote: Whenever I open the tinderbox carried, I get its contents, despite a tinderbox also being in the Emporium. I expected that OPEN PACK would also reveals it contents: a tinderbox and rations.

I think there are two related issues here: 1) there aren’t two instances of rations here; instead you’ve created a rations item in Ganon’s Emporium, then when play begins you’ve moved it into the backpack, and 2) the rations (as well as the tinderbox, skein, etc. ) are scenery, so that’s why they’re not showing up when you open the backpack.

Are rations, tinderboxes, etc. all supposed to be kinds?

1 Like

I agree with your analysis of the backpack being created in Emporium and moved to player later. How do I make two (or more) backpacks? Or for that matter, of anything?
One pack is filled with player stuff, the other is empty to be filled later. This will be a common trope throughout the story.

The mystery here is that tinderbox is also scenery on a par with rations, but tinderbox shows up when examining and rations does not.

1 Like

It’s usually as simple as “a backpack is a kind of container. The second-hand pack is a backpack in the emporium. The satchel is a backpack. The player carries the satchel.”

That’s if you want distinct, named instances of the backpack kind; you can also just do “a backpack is in the emporium. The player carries a backpack.” But that can get trickier both for the player and for you, since neither of you can easily refer to a specific backpack.

The chapter on kinds in the docs is very helpful for how they work.

The other nice thing about doing it with kinds is that anything you specify about the kind applies to the individual items.

If you add “A backpack is openable and closed” then both the satchel and second-hand backback automatically are openable and closed, too. You can add all kinds of things that way. Properties, values, etc. You could add a carrying capacity or weight limit, a sturdiness, or whatever.

Going back to the other items, scenery is immobile. In the code you can move scenery via “now” statements but things the player can take or move shouldn’t be scenery.

1 Like

And contrariwise, things the player can’t take or move generally should be scenery (have shoved more than a few moons, trees, etc. down my pants by seeing what TAKE ALL will do :slight_smile: )

1 Like

When you moon somebody, you really moon them.

1 Like

I get that. Your clarifications help. I made the Emporium’s items for sale scenery so that they don’t show up when LOOKING in the Emporium. They are still manageable objects. When player ASK GANON ABOUT EQUIPMENT, a table of supplies shows up for the player to buy. Then the player can EXAMINE for more detail.

When the player buys an item, it will be transferred from Emporium to the player. It is possible that the player could have two backpacks. I like the idea of differentiating the player’s backpack as a satchel, though.

Lots of food for thought. I’ll give these a try.

1 Like

If each item is unique and you never want the items listed when looking when they’re for sale you could try making them undescribed when they’re first placed in the emporium. Then when a player buys one you move it to their satchel which should automatically make it described.

Though you’d still have to block taking. Something like

Check taking something from Ganon's Emporium:
	say "Look with your eyes, not your hands. If you see something you like you can BUY it or you can EXAMINE it to find out more about it." instead.

I don’t have Inform handy right now so that’s pseudocode but you get the idea.

2 Likes

This is a good general idea, but flagging that this particular rule will softlock you if you drop an essential item in the emporium, because you wouldn’t be able to pick it up again. You’d want to get more specific, like maybe putting the store’s wares on a counter or something like that and having the rule just apply to taking something from that (and block the player from putting anything in/on that!) Or just do a block dropping rule so that the player can’t litter up the store, perhaps.

1 Like

Yes, in my head I was imagining Ganon’s Emporium stall (a supporter or container) not a room and I’m not sure why.

And even then you’d still need to prevent the player from putting things on/in it.

Ooo, what about putting the things for sale inside a transparent, closed, unopenable container e.g. a display case? Then the player can’t take them because they’re inside a closed container. When they take the buy action you just move them to the satchel via a “now” statement.

And if you make the container scenery the things inside it won’t be listed during a look.

From 3.8

[scenery containers’] contents are assumed to be less immediately visible, and will be mentioned only if the player looks inside them.

Can you examine through a transparent container?

2 Likes

That’s true, however, when it comes to containers that we don’t want players to be able to carry around (like wardrobes), if we want to set them as scenery while still benefiting from the dynamic display of their contents, we need to work on the room descriptions. For example:

[…] next to a [red box][if the red box is an already-discovered shower container] (which contains [a list of things in the red box])[otherwise][end if] in the sand behind the […].

On the other hand, this method doesn’t work if the container (or supporter) is a duplicate. (or rather, I should say, I don’t know how to make it work.) In such cases, it’s better to use the fixed in place property and rely on the default listing nondescript items function.

1 Like

Slow down guys. I am still trying to get a backpack in the emporium and on the player. I made backpack a kind of container, and a satchel a backpack for the player. However, the parser won’t let me make a backpack in the Emporium bc I’ve already made it a kind of container. It also won’t let me say A satchel is a backpack. What should it say?

It won’t be practical for my story to have to make dozens of unique things. Isn’t that why KINDS was invented?

I seem to be missing something here.

A carryAll is a kind of container. CarryAll is openable and closed.
A backpack is a carryAll. 
Description of backpack is "A small traveling pack that you wear on your back. It is made of leather with many pockets. It also has a few loops for attaching other things."
Understand "pack" as backpack. 
A satchel is a backpack. [For the player only.]

The parser will not let me make a satchel.

Container → carryAll → backpack → satchel.
Why won’t that work?