The same functionality, but making the player continue to move until he reaches his destination or a barrier, handling all openable doors on the way.

The foregoing example moves the player one location towards his destination, and requires that rooms have been visited before. But suppose we wanted to be a bit more lenient about movement, and let the player make as many steps as necessary per turn. We will also show consideration about doors, using the "Locksmith" extension supplied with Inform. (Now every time the code attempts opening a door, unlocking rules will also be invoked.)

"Safari Guide"
Include Locksmith by Emily Short.
The Monkey House is a room. The African Grasslands Exhibit is north of the Monkey House. The bird door is north of the African Grasslands Exhibit and south of the Aviary. The Ostrich Enclosure is west of the Aviary. The bird door is a door. It is closed, lockable, and locked. The silver key is a passkey. It unlocks the bird door. The player carries the silver key.
Understand "go to [any room]" as going by name. Understand "[any room]" as going by name. Understand "[door]" as entering.
Going by name is an action applying to one thing.
Check going by name:
   if the noun is the location, say "You're already in [the location]." instead.
Carry out going by name:
   while the player is not in the noun:
      let heading be the best route from the location to the noun, using even locked doors;
      if heading is not a direction, say "You can't think how to get there from here." instead;
      let destination be the room heading from the location;
      say "(heading [heading])[command clarification break]";
      try going heading;
      if the player is not in the destination, rule fails.
Test me with "go to aviary / go to ostrich enclosure / african grasslands".
Test me with "go to aviary / go to ostrich enclosure / african grasslands".
Monkey House

>(Testing.)

>[1] go to aviary
(heading north)

African Grasslands Exhibit
You can see a bird door here.

(heading north)
(first opening the bird door)
(first unlocking the bird door)
(with the silver key)

Aviary
You can see a bird door here.

>[2] go to ostrich enclosure
(heading west)

Ostrich Enclosure

>[3] african grasslands
(heading east)

Aviary
You can see a bird door here.

(heading south)

African Grasslands Exhibit
You can see a bird door here.

Notice that we continue the movement until one of two things happens: either the player reaches the room that is his destination, or the going attempt doesn't work. In the latter case we stop the action in order to avoid hanging the game up in a loop. This event might occur when the player runs into a locked door, for instance.