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 4 - Definitions

[ Some doors slam shut when you go through them - but only when going outside! Mark the outside location of such doors as "windy".]
A room can be windy or calm. A room is usually calm.

[ The modified version of Locksmith only applies to "public" doors, i.e. doors the player can freely unlock and open. Private doors will obstruct the player if closed, without automatically trying to unlock them. ]
A door can be private or public. A door is usually public.

[ A few items in this game are hidden and can be found by examining a particular item. This implements a generic way of handling this.]
A hidden object is a kind of thing. A hidden object can be found or not found. A hidden object is usually not found.

A hider is a kind of thing. A hider has a thing called the hidden. A hider has a text called the exclamation. A hider has a text called the scorename. The scorename is usually "". A hider has a number called the takeflag. The takeflag is usually 1.

Instead of examining a hider:
    if the hidden of the noun is not found begin;
        say "[the exclamation of the noun] You've found [a hidden of the noun].";
        now the hidden of the noun is found;
        now the hidden of the noun is known;
        if the hidden of the noun is portable and the takeflag of the noun is 1 begin;
            say "You take [the hidden of the noun].";
            move the hidden of the noun to the player;
        otherwise;
            move the hidden of the noun to the location;
        end if;
        if the scorename of the noun is not "",
            record the scorename of the noun as achieved;
    otherwise;
        say "You search carefully, but find nothing new.";
    end if.

[ Characters move around the map - this routine sends them in a particular direction and notifies the player if he can see the character arriving/leaving ]
To send (character - a person) to the (dir - a direction) with (summary - a text):
    if character is in the location begin;
        if summary is "default",
            say "[The character] wanders [dir].";
        otherwise
            say "[summary][line break]";
    end if;
    if character is in the green and dir is east begin;
        move character to library-room;
    otherwise;
        if the character is in the library-room and dir is west,
            move character to green;
        otherwise
            silently try character trying going dir;
    end if;
    if character is in the location begin;
        say "[The character] has just arrived.";
    end if.

[ Only certain items can be put into the player's pocket ]
A thing can be pocketable or not pocketable. A thing is usually not pocketable.

A key is a kind of thing. A key can be found or not found. A key is usually not found. A key is pocketable. The description is "An extremely useful device for unlocking doors, chests and the like.".

[ Shop doors can't be closed ]
A shop door is a kind of door.
Instead of closing a shop door:
    say "There's no point in doing that.".

Before printing the name of something: omit contents in listing.

[ This ensures that moving the player "manually" looks the same as normal
compass direction movement - it fills in the missing linebreak ]
To send the player to (destination - a room):
    say command clarification break;
    move the player to destination.