Fun with scope

I’ve just made a change to the way my game is structured that I expect to cause a load of new bugs. Fun times!

Specifically, the player is now confined to one room but can still see into other rooms. (Think of it like a security guard sitting in front of a bank of video screens.) I’ve tried putting the other rooms in scope, but I still haven’t worked out all the bugs. For example, if I try

say "The [noun] is in [the location of the noun]."

the location comes out as an empty string, e.g., “The apple is in the .” Any idea how to fix that?

Scope-expansion does not (of itself) affect the location of objects. A very simple example:

The Kitchen is a room.
The Bathroom is east of the Kitchen.

The apple is in the Bathroom.

Instead of examining the apple:
	say "The [noun] is in [the location of the noun]."

After deciding the scope of the player while the player is in the Kitchen:
	place the contents of the Bathroom in scope.

You must be doing something else.

Ah, you’re right–I had a different rule that turned off printing room names. Not a scope issue after all!

So, a question that probably really is a scope issue: I’m in a room other than the kitchen, but the kitchen is in scope. The command X KITCHEN works insofar as Inform prints the description text of the kitchen, but it excludes the contents (e.g., “In the kitchen is a counter on which are an apple and a banana”). How do I get it to print the contents of the kitchen as well?

Now that’s a bit more complicated. You need to invoke a variety of activities in just the right way. In fact, the easiest way is often to store where the player is, then move them, then move them back without printing a room description.

At the moment, I’m doing this:

The kitchen is east of the living room. "Clean and functional. [if the kitchen contains something][paragraph break]In the kitchen you can see [a list of things in the kitchen].[end if]".

which seems to work well enough, even if it doesn’t include the contents of containers or supporters in the kitchen.

The activity that lists and describes the contents of a room is the “printing a locale description” activity. You could use an after examining rule to carry out that activity manually. Something like this:

[code]The Viewing Room is a room. “A glowing monitor provides an outlet for your voyeuristic impulses.”

The Waiting Room is a room. “Gray, severe, and devoid of exits.”

A table and a vending machine are in the Waiting room. On the table is a switchblade, a pocket watch, and a vase. In the vase is a single wilted chrysanthemum.

The initial appearance of the vending machine is “A vending machine hums in the corner.”

Rule for deciding the scope of the player when the location is the Viewing Room:
place the Waiting Room in scope.

Before examining a room when the location is not the noun:
say “You peer into the monitor to see what’s happening in [the noun].”

After examining a room when the location is not the noun:
carry out the printing the locale description activity with the noun.[/code]

How do you move the player without printing a room description?

Move the player to [some place], without printing a room description.