Two doors in the same direction

I am trying to implement a door with a smaller embedded door. I was somewhat startled to discover that two doors in the same direction are disallowed.

catdoor is east of street.
catdoor is west of apartment.
maindoor is east of street.
maindoor is west of apartment.

throws an error. Well, I guess I shouldn’t be too surprised.
I would like to have two different doors with different conditions for entering. Is there an easy workaround?

The reason you can’t have multiple doors in the same direction is that Inform can’t figure out which one you want to go through when you type “GO EAST”. (Imagine if they led to different locations…)

So I would make them two parts of a single door!

A fake-door is a kind of thing.
A fake-door can be openable.
A fake-door can be lockable.
A fake-door can be open or closed.
A fake-door can be locked or unlocked.
A fake-door is usually openable, closed, lockable, and locked.

The doorframe is a door. It is open and not openable.
It is east of the Street and west of the Apartment.

The main door is a fake-door. It is part of the doorframe.
The cat door is a fake-door. It is part of the doorframe.
To decide whether either door is currently open:
    if the main door is open, yes;
    if the cat door is open, yes;
    no.

Instead of going through the doorframe:
    if either door is currently open, continue the action;
    say "Both doors are currently closed." instead.

Most of this code is just telling Inform that these fake doors are allowed to have all the properties normal doors have. Once these properties are applied, the normal rules for locking and unlocking and opening and closing work automatically.

3 Likes

There is an extension easydoors designed to address this very problem. (You should also be able to download the extension through the public library tab on the I7 IDE.)

2 Likes

The Easy Door extension looks really cool and I may use it for future parts of my game. For now, I’ve managed to code a set of door-like objects which behave the way I want them to, taking inspiration from Daniel Stelzer’s posted solution.

1 Like