The Beast of Torrack Moor

An interactive fiction by Linda Wright (2007) - the Inform 7 source text

Home page

Contents
Previous
Next

Complete text
Section 1 - The matching key rule

This is the need a matching key rule:
    if the noun provides the property matching key
    begin;
        let the item be the matching key of the noun;
        if the person asked encloses the item
        begin;
            change the second noun to the item;
            abide by the must have accessible the second noun rule;
        otherwise;
            if the player is the person asked, say "You lack a key that fits [the noun].";
            stop the action;
        end if;
    otherwise;
        if the player is the person asked, say "You lack a key that fits [the noun].";
        stop the action;
    end if.

Definition: a thing is key-accessible:
    if the person asked carries it, yes;
    no.