How to look at something?

I just began working with Inform7 today, so I know this is probably the stupidest, most obvious question in the world, but I’d appreciate if someone could point me in the right direction.

So, I made my first room, filled it full of stuff, and wrote descriptions for all that stuff. When I tried the game out, it posted all of those descriptions right out in the open. How do I make it hide those descriptions until the player types in “Look at [thing]” or “Examine [thing]”?

I can’t make a 100% confident diagnosis without seeing your code, but I have a hunch that it’s a matter of mixing up the syntax for descriptions with the syntax for initial appearances.

The initial appearance of an object is text along the lines of “A blood-stained dagger lies abandoned on the ground.” that should appear along with the room description. You can include it by saying The blood-stained dagger is in Dark Alley. The initial appearance of the dagger is "A blood-stained dagger lies abandoned on the floor."

And then you would go on to say something like The description of the blood-stained dagger is "The dagger has your fingerprints on the handle and your initials engraved on the blade." which is what you want to show up when I enter the command EXAMINE DAGGER.

If you just say something like The filthy puddle is in Dark Alley. "The surface of the puddle reflects the neon sign above." then Inform 7 interprets the text in quotation marks as the initial appearance of the puddle, so the game puts it out in the open. To make the compiler understand your text as the description of the puddle, you have to be explicit: The description of the puddle is "blah blah whatever."

5 Likes

I’m guessing Ryan is right! This is a common first thing to happen when starting out in Inform.
You can compare these:

Lab is a room. A rock is in Lab. "It's craggy and gray."
Lab is a room. A rock is in Lab. The description of the rock is "It's craggy and gray."

and combine them:

Lab is a room. A rock is in Lab. "A small rock lies on the floor." The description of the rock is "It's craggy and gray."

(You can also explicitly declare “The initial appearance of the rock is…” if you want to make sure that your string will get assigned to initial appearance.)

There’s more on this in §3.11 of the documentation. (This is not intended to suggest that you should’ve found this in the documentation before asking! The documentation is long and it’s often hard to find things–just about nobody absorbs the whole thing before they start programming.)

By the way, an exception to the “quoted string just after the thing is declared is initial appearance” rule comes when the thing is scenery. Scenery doesn’t show up in the room description, so it doesn’t have an initial appearance, and Inform will interpret a quoted string to be the description. So:

Lab is a room. "This lab contains a large gray craggy immovable rock for some reason, seems more like a cave than a lab."
A rock is scenery in Lab. "It's craggy, gray, and too large to pick up."
2 Likes

I forgot about this inconsistency with scenery! I always make it explicit whether I’m talking about an initial appearance or a description.

But, and here’s a hot tip for everyone, I usually write like

The curling iron is in the garage. Initial appearance of the curling iron is "That curling iron is here again." Description of the curling iron is "Tom keeps leaving this in the garage and it's infuriating."

This compiles fine even though I leave out the word The, and I can use all the time this saves to type more effective and evocative descriptions and initial appearances.

3 Likes

If I’m not mistaken, a, an, and the are always optional (ignored by the compiler) except in quoted strings and the like.

1 Like

Not entirely true. The compiler notices when you say “The Prince is a person” vs “Prince is a person” and guesses whether to apply the proper-named property.

But in most cases, yes, ignored.

4 Likes

Also some canned phrases like names of activities–in “Rule for deciding the concealed possessions of the player” and “Rule for printing a refusal to act in the dark” the “the” is mandatory.

(By contrast, The The is not mandatory but is a matter of taste.)

2 Likes

Interesting example – I see that Deciding the concealed possessions of something is a built-in activity.

Would it even be desirable for authors to be able to write “The rule for deciding concealed possessions” instead as an alias?

I saw this question and attempted to code an example for it. Your mileage may vary :slightly_smiling_face:

The scene is an attic that contains a pile of junk. There are several items ‘inside’ the junk pile but none of them are overtly described as part of the room description. Instead, the player must search the junk pile to find out what objects are in the pile itself. Once the player learns about the items in the junk pile they can take them into their inventory and examine them for further additional descriptions. Dropping an item yields a message that the player has put the object back into the junk pile. Here is the code I wrote:

Attic is a room.  
The description of Attic is "This is a large dusty attic containing a pile of junk."  
A trunk, skis, and rug are in the Attic.
The description of trunk is "This is an old wooden trunk with an iron lock.".
The description of skis is "These are an old pair of wooden skis with faded peeling paint on them.".
The description of rug is "This is an old faded oriental rug.".  The trunk, skis, and rug are undescribed.
There is a junk pile in the attic.  The junk pile is scenery in the attic.
The description of the junk pile is "It appears to be a pile of various odds and ends that were stacked up and stored here for many years.".

Instead of dropping something (called S) in the Attic:
	say "You casually toss it back into the junk pile in a haphazard manner.  After all it is just junk.";
	Move S to Attic;
	Now S is undescribed;
	
Instead of searching the junk pile:
	Let O be the list of objects that are not the player in the Attic;
	Remove junk pile from O;
	say "You rumage around in the attic and find several noteworthy items:[line break][line break]";
	Repeat with item running through O:
		say " - [item][line break]";

The game play turns out like this:

Attic
This is a large dusty attic containing a pile of junk.

>look at junk
It appears to be a pile of various odds and ends that were stacked 
up and stored here for many years.

>search junk
You rumage around in the attic and find several noteworthy items:

 - trunk
 - skis
 - rug

>l
Attic
This is a large dusty attic containing a pile of junk.

>look at trunk.
This is an old wooden trunk with an iron lock.

>look at skis.
These are an old pair of wooden skis with faded peeling paint 
on them.

>look at rug.
This is an old faded oriental rug.

>take rug
Taken.

>search pile
You rumage around in the attic and find several noteworthy items:

 - trunk
 - skis

>i
You are carrying:
  rug

>drop rug
You casually toss it back into the junk pile in a haphazard manner.  
After all it is just junk.

>l
Attic
This is a large dusty attic containing a pile of junk.

>search junk
You rumage around in the attic and find several noteworthy items:

 - rug
 - trunk
 - skis
1 Like