Secret Room — 1 of 0

John Timmons

Release 1

"Secret Room" by John Timmons

The release number is 1. The story creation year is 2007. The story headline is "Creating a secret room". The story description is "This demonstrates how we might create a secret room that is only accessible by a special closet elevator utilizing a device and playing with room mapping. This is based on 'The Unbuttoned Elevator Affair' example in Chapter 3.3 in the Inform documentation."

Release along with the source text and a website.

The Foyer is a room. "An empty room with a small closet to the north."

[Look at this carefully. We declare that the Closet room is north of two different rooms with two separate sentences. The first sentence takes precedence by default.]

The Closet is north of the Foyer. The Closet is north of Grandma's Secret Laboratory. "This closet seems somewhat sophisticated for a closet. There is an exit to the south."

[We place a device in the Closet that will act as our "trigger" to access the Laboratory.]

A small switch is a device in the Closet. It is fixed in place.

[This instead rule is where we pull off the trick. First, using an if statement, we check to see if going south from the Closet will lead us to the Foyer. If that is true, then we change the map so that going south from the Closet will place us in the Laboratory. Second, if the previous condition is false, we use an otherwise statement to change the map so that going south from the Closet brings us to the Foyer. Last, we provide a printout to describe what is happening.]

Instead of switching on the small switch:

if Foyer is mapped south of the Closet, now Grandma's Secret Laboratory is mapped south of the Closet;

otherwise now Foyer is mapped south of the Closet;

say "The closet shudders for a second then begins to whir, descend, and slowly spin..."

[The description of the Laboratory will print a special description only if the room has been unvisited (or the first time) then otherwise prints a standart description.]

Grandma's Secret Laboratory is a room. "[if unvisited]Wonder of wonders - a secret passage! Looks like grandma had a secret life.[otherwise]The laboratory of your grandma's is quite the operation."

Test me with "n / x switch / turn on switch / s / n / turn on switch / s".