Another day, another extension

Have uploaded to the Inform extensions page updates of Locksmith and Facing, and a new extension called Approaches. Approaches implements a GO TO… command as found in the manual, but produces somewhat more elegant output, coping with cases where the player’s movement is blocked by a door or some other kind of movement requirement. For instance:

You go north to the aforementioned unwelcoming hut, north again to the unattended pathway, north again to Paris and west to Bois du Boulogne.

or

You go north to the dusty street, then head west to the church. Entry into the church is barred without a hymnal, though.

or

You go north to the open field, then head north again to Seamus’ Hut. Unfortunately, you find you lack a key that fits the hut door.

or

You go to Crimson Chamber by way of Grooved Channel, Shallow Jade Amphitheater, Silver Filigree Prison and Mandarin Casket Room.

or… well, many other variations of your own devising, really. If you try it, though, remember to make sure you have the new Locksmith, too.

2 thoughts on “Another day, another extension

  1. Nice extension. But I have a problem:

    Key 1 unlocks the golden door.
    Key 2 unlocks the silver door.
    Key 3 unlocks the wooden door.

    Master key unlocks the golden door.
    Master key unlocks the silver door.

    But Inform 7 gives an error, because the golden door has key 1, and silver door has key 2.

    • Yes, I’m afraid so. That’s not a feature of the extension, though — you’d find the same thing if you left the extension out. In the standard rules, Inform defines the “lock-fitting” relation thus:

      Lock-fitting relates one thing (called the matching key) to various things.
      The verb to unlock (it unlocks, they unlock, it unlocked, it is unlocked)
      implies the lock-fitting relation.

      The “one thing… to various things” portion means that each key may open multiple doors, but a given door may be unlocked only by one key.

      There are several conceivable ways to deal with that. One would be to use the section-replacing syntax (see the documentation on Extensions for how to replace parts of the library from within your own code). That way, you could replace the relevant portions of the standard rules to make lock-fitting a various-to-various relationship (though you then have the problem that you can’t refer to *the* matching key of a door, since a door might have several matching keys).

      Another way — kludgier but faster — would be to write some instead rules that permitted the master key to override unlocking. But that would lose the benefits of Locksmith when it came to the master key.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s