I’m not sure if any of these things are in those player-convenience extensions Aaron’s been working on, but here’s my version, which is a little fancier:
[spoiler][code]Chapter - Exiting and Entering
Section - Transitive Exiting
Getting out of is an action applying to one thing. Understand “exit [something]” as getting out of.
Understand “out/off/down/up” as “[out]”. Understand “of/from” as “[from]”. Understand “[out]” and “[out] [from]” and “[from]” as “[out of]”.
Understand “exit [out of] [something]” as getting out of. Understand “get [out of] [something]” as getting out of. Understand “go [out of] [something]” as getting out of.
Check getting out of when the noun does not enclose the player:
say “You’re not [if the noun is a supporter]on[otherwise]in[end if] [the noun] right now.”
Check getting out of:
Let the outer enclosure be the noun;
while the outer enclosure encloses the player:
let the inner enclosure be the holder of the player;
If the inner enclosure is not the outer enclosure:
say “(First exiting [the inner enclosure])[command clarification break]”;
silently try exiting;
otherwise:
try exiting;
if the inner enclosure is the holder of the player:
stop the action;
Section - Going Outside
Check going nowhere when the noun is outside:
Try exiting instead.
Section - The Way Out
A room has an object called the way out.
Definition: A room is exitable if the way out of it is a direction.
Check exiting when the holder of the player is an exitable room:
Try going the way out of the location instead.
Check exiting when the holder of the player is a not exitable room:
If the number of viable directions is 1:
let the way out be a random viable direction;
say “(leaving to [the way out])[command clarification break]”;
try going the way out instead.
Section - The Way In
To decide whether (way - a direction) is a way in:
Let destination be the room to the way;
if destination is not a room, no;
decide on whether or not the way out of destination is the way from destination.
To decide what object is the way in:
Let the best choice be nothing;
Repeat with way running through directions:
if way is a way in:
if the best choice is a direction, decide on nothing;
otherwise now the best choice is way;
decide on the best choice.
Check going nowhere when the noun is inside and the way in is a direction:
Try going the way in instead.
Section - Intransitive Entering
for supplying a missing noun when entering (this is the enter the location rule):
Now the noun is the location.
The enter the location rule is listed after the find what to enter rule in the for supplying a missing noun rulebook.
Check entering the location:
Try going inside instead.
Check going nowhere when the noun is inside:
say “There’s no obvious way to go inside from here. [list the exits]” instead.
[/code][/spoiler]
This segment does not include a definition of “viable,” but I’m not sure the definition I’m using in my WIP is correct in all cases, so I’d rather not include it.