If you want “ENTER” to let you go inside when it’s possible to go inside, you can direct “enter” to a new action when you’re in the right location, and redirect that new action to going inside:
[code]Plain entering is an action applying to nothing. Understand “enter” as plain entering when the room-or-door inside from the location is not nothing.
Instead of plain entering: try going inside.
Hut Exterior is a room. “You can go inside the hut. The path leads east.” Hut Interior is inside from Hut Exterior. The Path is a east of Hut Exterior. “The hut is west.”[/code]
You could change the “Understand” clause to “when the location is the passageway,” and change the direction in “Instead of plain entering:” to whatever you like. This lets plain old “enter” take you to a room, but doesn’t let the player say “enter [name of room]” the way Felix’s code does. And you don’t need a door to do it.
It’s a lot easier to convert “exit” to going a direction when you’re in a particular place; since exiting is an action that doesn’t require a noun, you can just redirect it:
Instead of exiting when the player is in the Hut Interior: try going outside.
(There’s a subtlety here – unless I’ve messed it up “when the player is in the Hut Interior” is true when the player is in the Hut Interior but not in anything else. If you wrote “Instead of exiting in the Hut Interior,” it would make it impossible to carry out the exiting action when you were inside an enterable container in the Hut Interior, which would be bad.)
There are a couple of extensions – Emily Short’s Modified Exit and Aaron Reed’s Small Kindnesses – which will tweak the “exit” action to make it more friendly for you in a way like this.
You could avoid Felix’s concern about other enterable things in the passageway by building a list of the things you can enter. And in fact, you can even rig this so it automatically enters you into the only enterable thing or door in the room, if there’s only one. (The standard rules have something that does this, called the “find what to enter rule,” but it doesn’t apply to doors which could be annoying if something enterable winds up next to your door.)
[code]Use American dialect and the serial comma.
The passageway is a room. The red door is a door. it is west of the passageway and east of the red room. The blue door is a door. It is east of the passageway and west of the blue room. The box is an enterable container in the blue room. The crate is an enterable container in the blue room. The green room is west of the red room.
For supplying a missing noun when entering:
let enterlist be a list of objects;
now enterlist is the list of enterable things in the location;
add the list of doors in the location to enterlist;
if the number of entries in enterlist is 1:
now the noun is entry 1 in enterlist;
say “([the noun])[command clarification break]”;
otherwise if the number of entries in enterlist is 0:
say “There’s nothing to enter here.”;
say “You must supply a noun; you can enter [enterlist with definite articles] here.”
Test me with “enter/enter red/w/enter/e/enter/enter blue/enter/take box/enter/enter blue/drop box/enter/take box/enter red/w/drop box/enter”.[/code]
Looking at the Standard Rules, I don’t think there’s anything else enterable I haven’t thought of, but there might be. This doesn’t mix well with the plain entering action I put above. (Apologies for the lowercase room names.)
Now, what you might want is something like a disambiguation, where “enter” pops up “What do you want to enter, the red door or the blue door?” and lets you respond with “red.” That strikes me as something that would take a lot of work.