Two errors with doors

So I’m trying to make doors and containers which are lockable and unlockable, open-able and close-able. But I’m running into two problems with this.

  1. I wanted to include a basement which was up from the hallway. But with a locked door. The problem is, as soon as the player enters the hallway, they are met with the message saying “You can see a basement door here.” I don’t want them to have that message until they go up again, where the basement is. Is there some way to prevent the player from instantly facing the basement door. I’m concerned that will confuse the player from the other rooms in the hallway, which may not have doors at all. Do I need to include a table of rooms or something?

  2. I’m also having trouble with the command “open” and the inventory. If the player is near a door, or anywhere for that matter, when they have an inventory item, if they type in open, they’ll get a message saying “(inventory item) it isn’t something you can open.” I want the command “open” to be understood for opening doors and containers, not inventory items. I tried doing that with the understand rule, but it doesn’t seem to work the same way in this case.

Once again, any help would be greatly appreciated, thanks.

You might want to make the actual staircase itself a room that you access from the locked door. Then imagine that the player is halfway along the staircase, having up and down lead to where they need to.

I think by default open and close usually prefers something held.

Does the player mean opening a door: it is very likely.
Does the player mean closing a door: it is very likely.
Does the player mean opening something carried by the player: it is unlikely.
Does the player mean closing something carried by the player: it is unlikely.

For number 2, if you want to make “open” apply automatically to doors, you can use the “supplying a missing noun” activity, like this:

[code]Kitchen is a room. Basement is a room. The basement door is a door. It is down from Kitchen and up from Basement.

Dining Room is north of the Kitchen.

The player carries a rock.

Understand “open” as opening. [This is necessary to get Inform know to use the “supplying a missing noun” rules… it’s supposed to understand “open” without a noun, but the opening action requires a noun, so it looks to the supplying a missing noun rules for what to do]

Rule for supplying a missing noun when opening:
if the player can touch a door (called the portal):
say “([the portal])[command clarification break]”;
now the noun is the portal; […we supplied a noun, so the action can go on]
otherwise:
say “You’ll have to say what to open.” [the “supplying a missing noun” activity ended without supplying a noun, so the action aborts]][/code]

This might be an issue if there’s a room with two doors… it’ll automatically open one of them. You might want to write a case to capture that. Also, I think the issue with automatically filling in the inventory item as the noun only happens when the player has exactly one item in their inventory.

(You could also try does the player mean rules like Hanon suggests, but fair warning: I can never get those to work.)

For your first point, it’s trickier, because I’m not sure exactly what you’re trying to do. Inform doesn’t have a notion of facing per se–if you’re in a room, you don’t need to face a certain way to find the things that are in the room. So I’m not sure exactly what you want to achieve. If you don’t want to tell the player that the basement door is there until they do something else… well, that’s really going to confuse the player. To avoid confusing the player in other rooms in the hallway, you should just include the directions that they can go in the room description. (You can see how to do that in the example I give below.)

One thing you can do to avoid the awkward “You can see the basement door here” is to make the door scenery, which means it won’t show up in the room description, and then describe it in the room description. You can even include a flag to change the room description, depending on whether the player has seen that it goes to the basement or not. Here’s an implementation:

[code]Kitchen is a room. Basement is a room. The basement door is a door. It is down from Kitchen and up from Basement. It is scenery.

The basement door can be explored or unexplored. The basement door is unexplored.

After opening the unexplored basement door:
now the basement door is explored;
say “You open the door, revealing the basement.”

The description of the Kitchen is “A kitchen. You can go north to the dining room. [if the basement door is unexplored]There is a door here[otherwise]The basement door leads down[end if].”

Dining Room is north of the Kitchen. “You can go south to the kitchen.”

The description of the basement is “The basement door is here, [if the basement door is open]open[otherwise]closed[end if]. It leads back up to the kitchen.”

The player carries a rock.

Understand “open” as opening.

Rule for supplying a missing noun when opening:
if the player can touch a door (called the portal):
say “([the portal])[command clarification break]”;
now the noun is the portal;
otherwise:
say “You’ll have to say what to open.”[/code]

Also, shouldn’t the basement be down from the hallway rather than up?

Thanks so much you guys! I have several options to choose from now, for how I want to proceed with this.

It just now occurred to me that I’ve been treating up and down as north and south.