[Newbie] A door with a different name for each side

Hello all. Long story short, I bought my friend the GET LAMP documentary on DVD, and he pointed me to Inform, which I have been most impressed with. I never knew a tool of this quality existed.

I have a superb idea for a prototype collection of rooms I can use to teach me the system and explore many basic principles of the engine.

My problem is this: I am not able to clearly ascertain from the documentation I have understood thus far how to create a door that has a different name (not description) on either side.

Let us say there is a sitting room and a bedroom connected. When in the sitting room, I want the door to be called “The door to the bedroom”, but when you are in the bedroom I want it to be called “The door to the sitting room”.

Could I ask favour of your greater knowledge in this matter?


Also, but not as important, any general advice you could give on the following would be a bonus. Realistically, people do not talk about entering and leaving rooms in terms of cardinal positions. I do not explain to somebody in my house that they must go west to go into the living room. I would like my game to eschew the use of cardinal movement and instead let the play move from one room to the next through obvious, named entrances such as doors, paths, rooms, ladders and so forth.

I assume that this is both possible and relatively easy in Inform to do, and having your help solve the first problem, I’m sure the answer is not far off but any heads-up you can give on facilitating actions like “go through door”, “enter door” &c. would be a great help.

Kind regards,
Kroc Camen.

There are several examples that deal with variations of the renamed door, in the Inform Recipe Book, under Place / 3.5 Doors, Staircases, and Bridges. (If you can’t find the Recipe Book, scroll to the bottom of the table of contents for the main manual – there’s a link there.)

GO THROUGH DOOR and ENTER DOOR should work already, out of the box.

I had looked at those examples, but they just conditionally change the description of the room or the door, not the name of the door as it appears in the item list that proceeds the room description. Any further suggestions?

Correction: on further inspection, it appears that changing the description of the door, allows appending the description to the end of the room description, and as such one could wrangle some way of including the description of the door into the room. The only problem here is that if I want make mention of the door in the regular room description (say in the middle of the text), I then don’t want a description on the door, but if I add empty string “” to the end of the door, Inform still lists the door in the room using it’s canonical name, not the name I want. “You can also see a Bedroom Door here.”

Inform has an idea what I’m referring to when I use the other description–e.g. “Close the door to the bedroom” gives “I understand you as far as wanting to close the Bedroom Door”. I’m sure I can get Inform to pair together the two names. If anybody has a more elegant solution I would much like to know it :slight_smile:

Are you looking for something like this, using the printed name property?

[code]The Bathroom is a room. “A bathroom.” The Kitchen is a room. “A kitchen.” The white door is a door. The white door is north of the bathroom and south of the kitchen. The printed name of the white door is “[If the location is the bathroom]white door to the kitchen on the north wall[otherwise]white door to the bathroom on the south wall”.

Understand “kitchen” as the white door when the location is the bathroom. Understand “bathroom” as the white door when the location is the kitchen.[/code]

However, the output there is kind of fugly; you probably don’t want to say “You can see the white door to the kitchen on the north wall here.” For instance, you’ll notice that I had to include the direction in the name of the wall, or people wouldn’t know where to go. So it might be better to just include the description of the door in the room and suppress in the item list by declaring it as scenery, thus:

[code]The Bathroom is a room. “A bathroom. The white door on the north wall leads to the kitchen.” The Kitchen is a room. “A kitchen. The white door on the south wall leads to the bathroom.” The white door is a door. The white door is scenery. The white door is north of the bathroom and south of the kitchen.

Understand “kitchen” as the white door when the location is the bathroom. Understand “bathroom” as the white door when the location is the kitchen.[/code]

The “understand” stuff is still useful because it means “enter kitchen” or “open kitchen door” will work in the bathroom.

So there you mostly don’t have to worry about the printed name of the door, since it doesn’t even appear in the room description – but it does appear when you implicitly open it, or something like that. Paste in my last bit of code and try “go north”; it’ll say “(first opening the white door)”. If you’d like it to say “(first opening the kitchen door)” you can do that with a varying printed name, thus:

[code]The Bathroom is a room. “A bathroom. The white door on the north wall leads to the kitchen.” The Kitchen is a room. “A kitchen. The white door on the south wall leads to the bathroom.” The white door is a door. The white door is scenery. The white door is north of the bathroom and south of the kitchen. The printed name of the white door is “[If the location is the bathroom]kitchen door[otherwise]bathroom door”.

Understand “kitchen” as the white door when the location is the bathroom. Understand “bathroom” as the white door when the location is the kitchen.[/code]

Which as you can see basically combines the last two approaches.

I’m not a real experienced I7 coder, so there may be wrinkles (or big ol’ important things) I’m missing.

Hrm, somehow I missed your second post before I wrote mine, but to suppress “You see a Bedroom Door here” you can say “The Bedroom Door [or whatever you’re calling it in your code] is scenery.” Scenery won’t be listed after the room description. (That was in my previous post too, but maybe pretty well hidden.)

As for this:

I’m afraid it’s not quite as good as you hope – it’s understanding “door” but it might not be understanding “bedroom.” In the second and third example I posted, “close bathroom door” works but I don’t think “close the door to the bathroom” does. I’m not quite sure how to get that to work, other than maybe by brute-forcing it:

Understand "door to the bathroom" as the white door when the location is the kitchen. Understand "door to bathroom" as the white door when the location is the kitchen. Understand "door to the kitchen" as the white door when the location is the bathroom. Understand "door to kitchen" as the white door when the location is the bathroom.

Extremely informative, thank you!

I shall begin dissecting this info and get back to you if I run into problems.

Thank you for efforts!

Doors have a special “property” called “the other side” (viz. the room at the other side of the door). You can use it to name doors by default after the room they lead to.

[code]The bathroom is a room. “A bathroom. The white door on the north wall leads to the kitchen.”

The kitchen is a room. “A kitchen. The white door on the south wall leads to the bathroom.”

The white door is a door. The white door is scenery. The white door is north of the bathroom and south of the kitchen.

A door is usually scenery.
The printed name of a door is usually “[other side] door”.
[/code]
(or, if you prefer, »The printed name of a door is usually “door to the [other side]”.»

(I would also have expected
»Understand the other side property as referring to a door.»
to let you use “kitchen door” and “bathroom door” to refer to the same door from different sides, but it won’t compile on my old build of Inform. It may possibly work on the current build however.)