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 9 - Time/Weather/Light/Food

[ This variable is used to track how long the player can go in the rain without the kagoule ]
Sogginess index is a number that varies. Sogginess index is 0.

[ This tracks how dark it is ]
Darkness index is a number that varies. Darkness index is 0.

[ This tracks whether the player has eaten or not ]
Food index is a number that varies. Food index is 0.

[ Time of day ]
The current day is a thing. The current day can be day one or day two. The current day can be morning or evening. The current day is day one. The current day is morning.

[ In Moorland, we remind the player periodically that it's raining, and make him wetter and wetter. Also, if it's dark, various "creepy" messages are displayed ]
Moorland is a region.

Every turn when in Moorland and the current day is day one:
    [Weather ]
    if the sogginess index is 0 or the player is not wearing the kagoule begin;
        change sogginess index to sogginess index + 1;
        if there is an advice corresponding to a sogginess of sogginess index in the Table of Soggy Advice begin;
            say the advice corresponding to a sogginess of sogginess index in the Table of Soggy Advice;
            say "[paragraph break]";
        end if;
        if the sogginess index is 5 begin;
            move the player to barn;
            change sogginess index to 0;
        end if;
    otherwise;
        if the sogginess index is not 0 and a random chance of 1 in 10 succeeds,
            say "It's raining heavily.";
    end if;

    [ Darkness ]
    if the darkness index is 1 and a random chance of 1 in 4 succeeds begin;
        if the player is in near the combe and a random chance of 1 in 5 succeeds begin;
            say "In the distance, you glimpse the shadowy figure of a dark, cat-like creature stalking through the undergrowth before it senses your presence and bounds off...";
        otherwise;
            choose a random row in the Table of Creepy Events;
say "[event entry][paragraph break]";
        end if;
    end if.

Table of Soggy Advice
sogginess   advice
1   "It's started to rain."
2   "You're getting drenched."
3   "You really ought to have a rain-proof garment on..."
5   "You're absolutely drenched, wet through, dripping, sodden, and to top it all, you start sneezing and shivering. So much so, that you're forced to return to the village to seek shelter..."

Table of Creepy Events
event
"It's creepy!"
"You hear a muffled roar..."
"The sound of rustling grass and crackling twigs drifts on the wind..."

[ Handling darkness. The player can stumble around for a random number of moves before suffering an injury ]
Rule for printing the description of a dark room:
say "Unfortunately, it's too dark to see..." instead.

Rule for printing the announcement of darkness:
try looking.

Every turn when in darkness:
    if a random chance of 1 in 6 succeeds begin;
        say "It's so dark that you stumble and fall badly, breaking your leg... unable to move, you remain here overnight... the Ranger eventually finds you, and whisks you off to hospital, where you remain for a long, long time...";
        end the game saying "You didn't get the story";
    end if.