I7: seeing another room... I'm stumped!

This looks like the right place for this problem.

:arrow_right: I have a telescope that’s supposed to show a room down below, but I never get past errors or it just doesn’t show anything. I’m probably just exhausted and 2 steps away from figuring it out. I tried to use the scope rules in Manual 17.27, but I’m stuck. Honestly, I’m not even sure if that’s the best way to do what I want. There might be a better way than what I’m trying, so I’d love to hear about it. Thank you so-o-o much! XOXO

My whole program is pasted here with my problem and questions included as comments. I tried to make it as easy for people to help me as I could. I hope this works. :open_mouth:

[spoiler]“problem 01, seeing another room” by Nicole

section - about

[This little adventure will (eventually) star a timid and self-important kitty cat that won’t come out to eat unless conditions are perfect. I want you to be able to watch what the cat does through a telescope in the window. Every time you look, she will give you a clue about what needs to be done before she will finally eat her dinner.

I tried to use the scope rules in Manual 17.27, but I’m stuck. I’m not even sure if that’s the best way to do what I want.

How do I see what’s happening in the Courtyard through the telescope?]

test me with “x telescope/peek through telescope/x bag/get Kitty Kibbles/d,d/put food in dish/l/call cat/u/u/peek through telescope”;
test s with “u,u/examine telescope/look through telescope/peek through telescope”;
test t with “u,u/d/d/climb lovely oak tree/climb cat’s favorite oak tree/enter cat’s favorite oak tree”

section - once upon a time

Top Floor Apartment is a room. “A not-so-fancy apartment with a black and white chessboard floor. A window faces north. To the south is a winding staircase, leading down.”

In Top Floor Apartment is a bag of Kitty Kibbles. A description of bag of Kitty Kibbles is “Kitty Kibbles, favorite of cats everywhere.” In it is cat food. A description of cat food is “Shaped like little fish, birds, and mice. But made out of a mass produced, factory-processed corn product.” [Learn how to make unlimited supply of cat food]

[Question: How do I make it so you can only pick up the bag and not the cat food while its in the bag?]

section - THIS IS WHERE I NEED HELP

A telescope is a thing. “A brass telescope is pointing down through the window.” It is fixed in place. Understand “scope/lens/brass” as telescope.

Instead of examining telescope:
say “A lovingly cared-for antique telescope made of brass. [line break](HINT type: ‘peek through telescope’). [paragraph break]I DON’T KNOW HOW TO DO ‘LOOK THROUGH TELESCOPE’” […includes a message to my helpful testers.]

Peeking is an action applying to one visible thing. Understand “peek through [something]” as peeking.

Instead of peeking something that is not a telescope:
say “Get real…”

Instead of peeking telescope:
say “You peek thru the telescope and see the courtyard down below…”;
[This is a message to my helpful testers, to be removed when the problem is fixed:]
say "[line break]I WANT YOU TO SEE THE COURTYARD AS IT CURRENTLY IS HERE… ";
[ *** Here is the part that doesn’t work as expected…]
After deciding the scope of the player:
place the Courtyard in scope;

section - everything else

In Top Floor Apartment is a telescope.

Winding Staircase is a room. “A winding staircase, painted white, runs from the ground floor all the way up to the top of the building. Your apartment is on the top floor. A courtyard is on the ground floor, on the north side of the building.” In it are some stairs. Some stairs are scenery. A description of some stairs is “The stairs are made of wood. The bannister is painted white.” Understand “stair/step/steps/rail/bannister” as stairs.

Every turn when in Winding Staircase, say “You like the way your footsteps echo on the stairs.”

[I love this paragraph for some reason…]
Winding Staircase is south from the Top Floor Apartment. The Top Floor Apartment is up from the Winding Staircase. The Winding Staircase is up from the Courtyard. The Courtyard is north from the Winding Staircase.

Instead of examining down when player is in Winding Staircase: say “You see all the way down to the ground floor. High up places make you feel kind of dizzy.”
Instead of examining up when player is in Winding Staircase: say “You see past all floors to very top. Why isn’t there an elevator in here?”

Courtyard is a room. A description of Courtyard is “A courtyard below a very tall red brick building. Through the entryway, to the south is a winding staircase, leading up. [paragraph break]There are two very large and beautiful oak trees here, spreading their arms to heaven.”

A lovely oak tree is a thing. It is scenery. Instead of entering lovely oak tree: say “Ouch! The bark is too rough for climbing!”

The cat’s favorite oak tree is a thing. It is an enterable container and scenery. After entering favorite oak tree: say “You climb the familiar branches until you reach your familiar branch.” Instead of going down when player is in cat’s favorite oak tree: try exiting.

Every turn when in the cat’s favorite oak tree, say “The wind caresses your skin as you sway with the branches.”

[How do I make it so that Inform 7 assumes the player is going to climb the cat’s favorite oak tree? It keeps asking me “which tree do you mean? and then it doesn’t work anyway…”]
Instead of climbing [something] tree:
try entering tree. [ *** THIS ISN"T WORKING!]

In Courtyard is a lovely oak tree. [squirrel’s tree]
In Courtyard is the cat’s favorite oak tree.
In Courtyard is a dish. It is fixed in place and a container.

[Learn how to differ between the two trees with just one word. It gets tedious typing lovely, cat’s, or favorite. ]

Calling is an action applying to one thing. Understand “call [something]” as calling. Instead of calling cat: say “‘Here, kitty kitty kitty!’”

[Conditions before cat will eat: food in dish, squirrel busy in tree, garnish in dish, player must call kitty kitty, player up in apartment, opera music playing, etc.]

section - next work

[Learn how to make a cat and a squirrel that interacts with the player and things the player leaves lying around.][/spoiler]

You need to tell Inform to print the description of the Courtyard, so the code is:

Instead of peeking telescope:
say “You peek thru the telescope and see the courtyard down below…[line break][description of Courtyard]”;

The deciding the scope activity does not control this. It’s only needed here for the player to examine the objects in the Courtyard (being able to see distant objects).

TY, i-k.

Here is what prints now: [spoiler]>peek through telescope
You peek thru the telescope and see the courtyard down below…
A courtyard below a very tall red brick building. Through the entryway, to the south is a winding staircase, leading up.

There are two very large and beautiful oak trees here, spreading their arms to heaven.[/spoiler]Okay. This does work as you said. Now I have two problems.

  1. It doesn’t print the things in the room (dish, cat food) that print when I am in that room .

  2. My description of the room (the Courtyard) includes things that are visible from the room that shouldn’t be visible thru the telescope (red brick building, entryway). Since its not a magic telescope, how can I make a special description of the far away room that includes the things that are in it (cat, dish, squirrel) but not things that would be impossible to see (red building, a window with a telescope in it) from the player’s point of view? Is there a way to have more than one room description, so I can decide which one to use when I need it?

TIA

Could you possibly make two rooms, one which you cannot enter and one (the real courtyard), varying the descriptions that way?

You could very likely write a set of variables which the clone room will mimic changes of the real room.

It sounds like the telescope is trained on just one other room. If that’s correct, you can just do these things manually in the telescoping rule:

Instead of peeking through the telescope: say "Looking through the telescope, you can see a courtyard in the shadow of what is probably a building. In the courtyard, you see [a list of things in Courtyard]."

The “list of things in the Courtyard” token prints the names of the things in the remote room dynamically–whatever’s there when the player looks through will be printed. You can also be more explicit about what to list; for example, if you use an adjective to define small and large categories for things, then you could write “[list of large things in the Courtyard]” to leave out ants and dragonflies while still listing cats and squirrels.

If you prefer to add a separate description to the room (useful if your telescope can be used to look at several different rooms), you can do that by adding a new property to the room kind:

[code]A room has some text called the telescopic description. The telescopic description of the courtyard is “a courtyard in the shadow of what is probably a building. In the courtyard, you see [a list of things in Courtyard].”

Instead of peeking through the telescope:
say “Looking through the telescope, you can see [telescopic description of the noun].”[/code]

–Erik

EDITED to fix the construction of the rule that uses the telescopic description.

Here’s another way you can have two (or more) room descriptions:

Courtyard is a room. A description of Courtyard is "[if the location is Courtyard]A courtyard below a very tall red brick building. Through the entryway, to the south is a winding staircase, leading up. [paragraph break]There are two very large and beautiful oak trees here, spreading their arms to heaven.[otherwise]HERE YOU WRITE WHAT THE COURTYARD LOOKS LIKE WHEN VIEWED THROUGH THE TELESCOPE. MAYBE ADD [a list of important things in Courtyard] OR SOMETHING SIMILAR."

And also, I forgot to mention this earlier about the deciding the scope activity:

The code should be something like this:

After deciding the scope of the player:
	if the location is Top Floor Apartment and the telescope is tried, place the Courtyard in scope;

If you just say that Courtyard is in scope, it will be in scope all the time everywhere. That’s why you need to specify a bit.

The “telescope is tried” -part is for determining whether the player has discovered the abilities of the telescope and thus knows that she can see all the way to the Courtyard.

So, add something like this:

The telescope can be tried or untried. The telescope is untried.

After peeking the telescope for the first time:
	now the telescope is tried;
	continue the action;

Note: you must then use a carry out -rule for the peeking, not an instead-rule:

Carry out peeking telescope: 
	say "You peek thru the telescope and see the courtyard down below...[line break][description of Courtyard].";

(After-rules don’t work with instead.)

Yet another solution might be to actually move the player to the courtyard but prevent him from doing anything to the things there but examining them as long as he is watching them from the telescope.

The Top Floor is a room.
A telescope is a thing in the Top Floor.

The Courtyard is a room. "[if the player is telescoping]In the courtyard below there is[otherwise]Below a very tall red brick building there is a courtyard with[end if] one not too huge tree and a few people." 
A tree is an open transparent container in the Courtyard. "Up in the courtyard tree you see Kalle." The description of the tree is "This should be the perfect tree for climbing." 
Kalle is a man in the tree. The description of Kalle is "He is dreaming of Emma". 
Emma is a woman in the Courtyard. The description of Emma is "Emma is only a dream." 
Grandpa is a man in the Courtyard. The initial appearance of Grandpa is "Below the tree sits Grandpa reading the news". 
Grandpa carries the news. The description of the news is "The paper says 'Activision releases Zork to public domain'." 

Peeking through is an action applying to one thing.
Understand "peek through [something]" as peeking through.

Yourself can be telescoping. Yourself is not telescoping.
	
Carry out peeking through the telescope:
	now the player is telescoping;
	say "You peek thru the telescope and see the courtyard down below...";
	move the player to the Courtyard.
	
After printing the name of the courtyard while the player is telescoping: say " (through the telescope)".
	
Before doing anything other than examining something enclosed by the Courtyard or looking when the player is telescoping:
	move the player to Top Floor;
	now the player is not telescoping;
	say "(in the Top Floor Apartment)".

(Or if it is for some reason inconvenient to have the player in the courtyard, you could move him there and back to the Top Floor while adding the courtyard to scope:)

Carry out peeking through the telescope:
	now the player is telescoping;
	say "You peek thru the telescope and see the courtyard down below...[line break]";
	move the player to the Courtyard;
	move the player to the Top Floor, without printing a room description.

After deciding the scope of the player while the player is telescoping:
	place the Courtyard in scope.
	
Before doing anything other than examining something enclosed by the Courtyard when the player is telescoping:
	now the player is not telescoping;
	say "(in the Top Floor Apartment)".

:astonished: Whoa, that’s a lot of ways to look into another room! :open_mouth:

I’m going to try everything you guys shared, I hope I have enough summer left!