[i7] Objects in containers

I’m new to Inform (sort of. I messed with a version of Inform way back circa 1997, but never did much with it.) and am having a bit of a problem. I’m designing a room with a pile of dirty clothes in it. I want the player to have to search through the pile a bit (really just use “look in pile”) to find an item inside it. I can get this to work fine, but there’s a problem: typing “take all” pulls the item out of the pile, even if you’ve never looked in it. Based on the Inform documentation, it seemed like defining the pile as opaque should prevent take all from taking something out of a container you haven’t looked in, but it doesn’t. Either I misread the documentation or am doing something wrong. I suppose I could make it a closed container, but typing “open pile of dirty clothes” seems nonsensical to me. I also thought about making it so the item doesn’t exist (ie, it’s off stage) until the pile of clothes is looked in, but Inform returns plenty of errors when I try to do that.

I’ve spent the past half hour or so googling this and haven’t come up with much of anything. I figure this has to have been covered before, but I just can’t seem to find it mentioned anywhere. Any advice?

Two different ways to approach this:

  1. You could not move the item to the pile until the player searches the pile. (“After searching the pile: now the item is in the pile.”)
  2. You could use a “Rule for deciding whether all includes” – check chapter 17.34 in the documentation.

Oh, I just re-read your post and see that you’re trying the first thing I mentioned. If you post the relevant code and error messages, we can try to figure out where you’re going awry.

Thanks. I got an extension (Underside by Eric Eve) and noticed the documentation mentioning an example like this, which is what gave me the idea. Anyway, here’s the code (minus description text):

A pile of dirty clothes is in the Main Bedroom. A pile of dirty clothes is scenery. A Pile of Dirty clothes is a container. Instead of taking a pile of dirty clothes: say “There’s no way you can carry this much at once, this pile is giant. Maybe you could take just an item or two?”
A pair of pants is a thing. Understand “pants” or “trousers” or “jeans” as a pair of pants. A pair of pants are wearable.
Before looking in the pile of dirty clothes when the pair of pants is off-stage: move the pair of pants into the pile of dirty clothes.

The error I get is: “You wrote ‘move the pair of pants into the pile of dirty clothes’ : but this is a phrase which I don’t recognise, possibly because it is one you meant to define but never got round to, or because the wording is wrong (see the Phrasebook section of the Index to check). Alternatively, it may be that the text immediately previous to this was a definition whose ending, normally a full stop, is missing?”

It seems I’m just phrasing the the last part wrong. I looked through the Phrasebook as the error message suggested, but I haven’t really been able to find anything relevant.

Thanks for helping!

“move the pair of pants into the pile of dirty clothes” should be “now the pair of pants is in the pile of dirty clothes”.

This isn’t called out in the phrasebook because it’s just “now … is …”, which is used for all sorts of relation-setting in I7.

There’s another issue here, and it’s subtle. Because you’ve declared the pile of dirty clothes as scenery (presumably because they’re mentioned in the room description), the response to ‘take all’ is “There are none at all available.” This happens because Inform never tries to take scenery … but it reads very badly here.

I’m not sure how to fix this. I tried this:

Rule for deciding whether all includes the pile of dirty clothes: it does.

That didn’t help. It ought to, I think.

Also, the way you have it set up, the pair of pants is moved into the pile only by searching the pile of clothes. The result (if the pile of clothes has no description, which in your code it doesn’t), is this: ‘x clothes’ … “The pile of clothes is empty.” Yet searching it reveals the pair of pants. Maybe you want examining the pile also to reveal the pants? If so:

Before examining or searching the pile of clothes: if the pair of pants is off-stage: now the pair of pants is in the pile of dirty clothes.

Actually, there is some description text in the original code. I took it out in my last post because I (mistakenly?) thought it wouldn’t be relevant to my problem. But I’ll see if the code you gave me fixes the problem. Hopefully it will. Thanks!

It might be worth pointing out, so you don’t think your mind is just making things up, that “move the player to whateverroom” is valid syntax (and is in fact the recommended way of teleporting the player), so that is probably why you tried that phrasing.

As a design suggestion, you might want to make examining the pile reveal the pants anyway, or at least give the player a strong hint that they haven’t searched through the pile and might want to. There’s some discussion of searching and examining here; several people said “search” essentially creates a guess-the-verb problem for them.

On the topic of get all…

If something is both scenery and something I tried to make sure would be interacted with by a ‘get all’ with the line:

Rule for deciding whether all includes puddle mud: it does.

Does the fact puddle mud is scenery override this rule? Atm in my game it does - trying to ‘get all’ doesn’t interact with puddle mud.

The rule that excludes scenery in the Standard Rules is:

Rule for deciding whether all includes scenery while taking (this is the exclude scenery from take all rule): rule fails.
The “while taking” part makes it more specific than your rule, so it get precedence. You can make your rule more specific by adding the “while taking” part as well:

Rule for deciding whether all includes puddle mud while taking: it does.

Ah, thanks.

I think you mean “searching the pile of dirty clothes”…? Unless your game defines a “looking in” action that is distinct from searching.

If you put your code samples in [code] tags, they’ll be easier to read.