6.6. Looking Under and Hiding

| Chapter 6: Commands |

| 6.6. Looking Under and Hiding

Finding hidden objects is a classic puzzle in IF. Beachfront provides the most basic example, an object that becomes visible only when we have searched the papers on a cluttered desk. Beneath the Surface takes this further, giving all large furnishings the ability to conceal items, and allowing the player to put things underneath other things, as well as find them. Flashlight adds an extra twist to the puzzle by requiring that the player have a flashlight to shine under a bulky object in order to find what lies underneath.

Looking inside an object is generally handled by the searching action, and we could extend that to allow the player to search multiple or complex objects. Matreshka turns the puzzle on its head by allowing the player to search a whole room systematically with only a single command.

See Kitchen and Bathroom for the related case of needing to look in a mirror

98
| Example Beachfront An item that the player can't interact with until he has found it by searching the scenery. |
WI

Suppose we have our player, a detective, searching for evidence; we don't want him to be able to use this evidence until he has performed the action that reveals it, but after that it should be visible in the room when he looks. A simple way to do this is to start the object -- an envelope, in this scenario -- out of play, and only move it into the location when the player looks for it: "Beachfront" The Stuffy Office is a room. "The windows are closed, making the sultry air even more unbearable. A narrow slice of Caribbean blue is visible between the scuba gear rental shop and the recreated 17th century pirate tavern. The office is cheerfully furnished with wicker chairs and white curtains, but the tropical decorating scheme stopped at the desk, which is heavy oak and absolutely covered with papers." The heavy oak desk is a supporter in the stuffy office. It is scenery. Understand "paperwork" as the desk. The creamy envelope is an openable container. The description is "There is no return address on the outside of the envelope, just the address of the Doctor's office -- but the legs of the capital A are rubbed down in a characteristic way, and the top of every R is open. There's no question that it comes from the same typewriter as the blackmail note." In the envelope is a letter. The envelope can be found or lost. The envelope is lost. Instead of searching the desk when the envelope is lost: now the envelope is found; say "You rifle through the piles of bills and notices; invitations to conventions; advertisements for high-end prescription drugs; pink carbon sheets bearing patients['] names and medical identification numbers in spidery, elderly handwriting. Almost at the bottom of the heap, you find what you were looking for: a creamy envelope with the address typed."; move the envelope to the desk. Here we've changed the property of the envelope to keep track of the fact that it has been found, so that if the player tries again, he won't find anything more. Instead of searching the desk: say "Further investigation of the desk reveals nothing else suspicious." Notice that we have two rules that apply to "searching the desk", but one of them has a more specific set of parameters ("when the envelope is lost"). This means that Inform will consult that rule first and use it if it applies; it will only carry out our plain vanilla "instead of searching the desk" rule when the more restricted rule is not relevant. Test me with "x envelope / x desk / search desk / look / get envelope / x envelope".

233
| Example Beneath the Surface An "underlying" relation which adds to the world model the idea of objects hidden under other objects. |
WI

218
| Example Flashlight Visibility set so that looking under objects produces no result unless the player has a light source to shine there (regardless of the light level of the room). |
WI

173
| Example Matreshka A SEARCH [room] action that will open every container the player can see, stopping only when there don't remain any that are closed, unlocked, and openable. |
WI

Previous | Contents | Next