Escapade!

An interactive fiction by Juhana Leinonen (2008) - the Inform 7 source text

Home page

Contents
Previous
Next

Complete text
Chapter Trapdoor switch

The switch is a thing. The switch has a trapdoorposition called the pos. The pos of the switch is left side. The switch can be operated. It is not operated.

The description of the switch is "The small switch on the trapdoor has been [if the pos of the switch is left side]pushed to one side[otherwise if the pos of the switch is mid-cell]set to the middle[otherwise]pulled to one side[end if]."

After opening the trapdoor:
    now the switch is a part of the trapdoor;
    continue the action.

Check pushing the switch:
    if the pos of the switch is left side:
        say "It won't go any further." instead.

Check pulling the switch:
    if the pos of the switch is right side:
        say "It won't go any further." instead.
        

Instead of switching on or switching off the switch:
    if the pos of the switch is left side:
        try pulling the switch;
    otherwise if the pos of the switch is right side or a random chance of 1 in 2 succeeds:
        try pushing the switch;
    otherwise:
        try pulling the switch.

Carry out pushing the switch:
    if the pos of the switch is mid-cell:
        now the pos of the switch is left side;
        now pos of the trapdoor is left side;
        say "The trapdoor slides to the left side of the room.";
    otherwise if the pos of the switch is right side:
        now the pos of the switch is mid-cell;
        now the pos of the trapdoor is mid-cell;
        say "The trapdoor slides to the middle of the room.";
    stop the action.
    
Carry out pulling the switch:
    if the pos of the switch is left side:
        now the pos of the switch is mid-cell;
        now the pos of the trapdoor is mid-cell;
        say "[one of]You flip the switch and the trapdoor slides effortlessly to the middle of the room. Where it used to be only solid stone floor remains.[paragraph break]'[if the tongue is numb]How huiouh[otherwise]How curious[end if],' you muse[if the creature is present]. [The creature] raises the spot above its eye where people usually have eyebrows[silent c][end if].[or]The trapdoor slides to the middle of the room.[stopping]";
    otherwise if the pos of the switch is mid-cell:
        now the pos of the switch is right side;
        now the pos of the trapdoor is right side;
        say "The trapdoor slides to the right side of the room.";
    stop the action.


Report pulling the switch:
    do nothing instead.
    
Report pushing the switch:
    do nothing instead.