Beginner question

[Apologies: This is an Inform 7 question, and might need moving to the “Inform 6 and 7 Development” forum]

I’m experimenting with Inform 7 and as an example of something I wish to do, let’s assume I want to have 2 rooms, with ten posters in each room and allow the user to read every poster.

First hurdle: I don’t want the posters to be listed in full when they enter the room (“There is also a first poster, a second poster, …”) so I’ve described them as scenery for now and just incorporated a description in the room’s description. Is this the best way to do this? What if I wanted them to be ten chests that can be opened, with a piece of paper in each one? How do I make it so that the user can open every chest (say, OPEN FIRST CHEST, OPEN SECOND CHEST) etc but still prevent the complete descriptions from appearing in the room description?

Second hurdle: I’d like to have one collection (of posters, or chests say) in the first room and another collection in the second room, but still allow the user to type “READ FIRST POSTER” or “OPEN FIRST CHEST” in each room independently. How do I get around the Inform contradiction of naming two objects the same name? What if there are pieces of paper in every chest and the user collects them all? How could they differentiate between all 20 pieces of paper in their inventory if they were to read them later?

Thanks in advance

If you really want ten posters, make a poster a kind of thing and give them different names.

[code]Test Room is a room. “Wow, look at all the posters in here!”

A poster is a kind of thing. Understand “poster/posters” as a poster. A poster is usually scenery.

a Doors poster is a poster in test room. some backlight art is a poster in test room.[etc.] [/code]

They’re all scenery, so if the player types “look at poster” it will disambiguate.

An alternate way would be to make all the posters one object, and use text variations.

[code]Test Room is a room.

some posters are a fixed in place thing in Test Room. “Plastered all over the walls is a psychedelic poster collection.”

The description of posters is “[one of]You take a look at the most prominent poster, showing Jim Morrison and the Doors.[or]The next poster is some simple backlight art of a mushroom.[or]The next poster you peruse features Janis Joplin.[cycling]”

Understand “next/psychedelic/wall/walls/poster/doors/black/light/blacklight/art/mushroom/jim/morrison/janis/joplin” as posters.

[/code]

That will basically cycle through all the posters as the player looks at them (actually the same object) repeatedly, even if they use different names.

[code]“Chests Galore” by Hanon Ondricek.

Test Room is a room. “You’ve made it to the magical Test Chamber, where great riches await in one of ten chests arrayed here in a semicircle.”

a chest is a kind of container. It is openable. it is usually closed. It is usually scenery.

a first chest, a second chest, a third chest, a fourth chest, a fifth chest, a sixth chest, a seventh chest, an eighth chest, and a ninth chest are chests in test room.

a mysterious jet black chest is a chest in test room.

A treasure is a kind of thing.

a blue sapphire is a treasure.
some savings bonds is a treasure.
a bag of FunYuns is a treasure.

When play begins:
repeat with prize running through off-stage treasures:
move prize to a random chest.

After opening a chest (called box):
if box contains something:
say “Aha! You found a prize!”
[/code]

You should be careful when moving prizes to a random chest. There is a chance that a chest can end up with more than one prize.

This rule will cause nothing to be printed when opening an empty box.

Try this.

[code]“Chests Galore” by Hanon Ondricek

The Test Room is A Room. The description of the test room is “You’ve made it to the magical Test Chamber, where great riches await in one of ten chests arrayed here in a semicircle.”.

A chest is a kind of container. A chest is openable, closed and scenery. A chest is either prized or unprized. A chest is unprized.

A first chest, a second chest, a third chest, a fourth chest, a fifth chest, a sixth chest, a seventh chest, an eighth chest, and a ninth chest are chests in test room.

A mysterious jet black chest is a chest in test room.

A treasure is a kind of thing.

A blue sapphire is a treasure. Some savings bonds are a treasure. A bag of funyuns are a treasure.

When play begins:
repeat with prize running through off-stage treasures begin;
let the chosen chest be a random unprized chest;
move the prize to the chosen chest;
now the chosen chest is prized;
end repeat.

After opening a prized chest: say “Aha! You found [the first thing held by the noun]!”.

Test me with “open first / open second / open third / open fourth / open fifth / open sixth / open seventh / open eighth / open ninth / open jet”.[/code]

This pretty much fixes the issues above.

Hope this helps.

Awesome. Thanks so much for the help.

In both of these cases I made those implementation choices on purpose. Finding a prize is more of an event than not finding a prize. You’re going to get an “aww, shucks, nothing in the box” message at least seven times. Of course this is exactly the kind of feedback that beta testers give.

What is “first thing held by the noun”?

Except that you’re not going to get an “aww, shucks, nothing in the box” message at least seven times. You’ll get no text whatsoever, not even the standard “You open the box” message. This is generally considered bad practice, so you shouldn’t be doing this on purpose. Also, if you run through enough times, eventually there will be a box with more than one prize in it and I don’t think that’s what was wanted. You can see this in action by simply adding more prizes.

The “first thing held by the noun” is basically the reverse of “holder of the noun”. However, since you can have more than one thing in/on something else, “first thing held by the noun” refers to the first thing in/on the noun. In this case, there is only one thing in/on the noun, so it will refer to that. See “8.17. Looking at containment by hand” in the Inform 7 Documentation.

Hope this helps.