[I6] Determining whether an exit is valid

Dear all,
in Inform 6, how can I test whether an exit is valid? Like, room 1 has a .w_to which is room 2, but how can I test whether in room 1 there’s a “before” routine that forbids the player to walk from room 1 to room 2 under certain conditions?
Thanks and kind regards,
Grues

There is no way but to perform the action and see if it succeeds. The keep_silent global may help with this.

It’s probably better to pull out the conditions into their own function so that you can call them separately.

Okay, thanks. What I have done now is to spend one of my precious free attributes for every room I don’t want my object to go to, and to check for that attribute. A clumsy workaround, but it works for my purpose. Shouldst I encounter problems (like a lack of free attributes) I shall dig into the more elegant solution you suggest.

In Inform7 it is possible to remap rooms during game play. Is it possible to map rooms dynamically in Inform6? My initial thought here is that you could conditionally add or remove mappings between rooms as needed in order to prevent access to rooms or grant it. This would eliminate the need to verify that a mapping exists in the first place. I made a quick attempt at remapping rooms dynamically so they can be accessed conditionally depending on if the player is holding a particular object or not using Inform7, here is what that looked like:

Forest is a room.  The description is "A dead forest surrounds you, plants attempt to grow but appear spindly and sick.  Dust and soot cover everything as far as the eye can see."

The Forest contains an ID Card.  The description of the ID Card is "Nuclear Shelter ID #198293 - Full Access."

Nuclear Shelter is a room.  The description is "This is a nuclear fallout shelter only accessible by authorized individuals.  Unauthorized individuals cannot travel into the shelter."

Instead of taking the ID Card:
	change the west exit of Forest to Nuclear Shelter;
	change the east exit of Nuclear Shelter to Forest; 
	Say "The moment you pick up the ID Card, you see something materialize out of the corner of your eyes.";
	Continue the action.
	
Instead of dropping the ID Card:
	change the west exit of Forest to nowhere;
	change the east exit of Nuclear Shelter to nowhere; 
	If the player is in Nuclear Shelter:
		say "The structure rumbles and shakes as you drop the ID Card";
	Otherwise:
		say "The structure vanishes from view as you drop the card";
	Continue the action.

Effectively, the player can only travel west from the forest or east from the shelter if they are holding the ID card. Here is how it plays out:

Forest
A dead forest surrounds you, plants attempt to grow but appear spindly and sick.  Dust and soot cover everything as far as the eye can see.

You can see an ID Card here.

>w
You can't go that way.

>e
You can't go that way.

>take ID
The moment you pick up the ID Card, you see something materialize out of the corner of your eyes.

Taken.

>w

Nuclear Shelter
This is a nuclear fallout shelter only accessible by authorized individuals.  Unauthorized individuals cannot travel into the shelter.

>drop ID
The structure rumbles and shakes as you drop the ID Card
Dropped.

>e
You can't go that way.

>w
You can't go that way.

>take ID
The moment you pick up the ID Card, you see something materialize out of the corner of your eyes.

Taken.

>e

Forest
A dead forest surrounds you, plants attempt to grow but appear spindly and sick.  Dust and soot cover everything as far as the eye can see.

>