Trying to find the best route even using locked doors?

I’m going through the basic Inform7 documentation and looking to create an object that points the character towards an object even through locked doors. Unfortunately, I’m unable to get this to work in my own problem. If I attach it do the description of an item, the game just stops. If I attach it to the description of room, it will force it to just disappear and be ignored as the player walks around.

I already have a lot of rooms in my game, so I tried testing this with the most basic game possible. I’m about to get the direction to appear, but it doesn’t point in the right direction, it just stays south. What am I doing wrong?

[code]The apartment is a room. The hallway is a room. The hallway is east of the Apartmentdoor.
Apartmentdoor is a closed, locked door. Apartmentdoor is east of the apartment.

The brass compass is carried by the player.

bestroute is initially south.

Instead of examining the brass compass:
say “The dial points to [bestroute].”;
let bestroute be the best route from the location to the hallway, using even locked doors.[/code]

You’re printing the varible before you’ve set it. Switch the lines in the instead rule around.

Also, you don’t need to declare the global variable; the local variable will override it anyway.

[code]The apartment is a room. The hallway is a room. The hallway is east of the Apartmentdoor.
Apartmentdoor is a closed, locked door. Apartmentdoor is east of the apartment.

The brass compass is carried by the player.

Instead of examining the brass compass:
let bestroute be the best route from the location to the hallway, using even locked doors;
say “The dial points to [bestroute].”[/code]

This works! Thank you so much.