First I define a kind of thing called a fence, then make an instance of it.
Fence is a kind of door. Fence is closed. Fence is not openable.
Fence is either opaque or transparent. It is transparent.
Description of the fence is "A rock wall at the base of vertical wrought iron bars. The wall is four feet high; the bars are another five feet above that, tipped by pointy barbs."
Understand "fence" or "rock wall" or "wall" or "bars" or "iron bars" as fence.
S_Fence is a fence. It is closed. S_Fence is transparent.
The S_fence is west of Thentis Road and east of SE_Graveyard.
Printed name of S_fence is "a rock wall and wrought iron fence".
Understand "fence" as S_fence.
I have a fence that can been looked through but the graveyard on the other side of the fence is not in scope, so although
look through fence
works fine to output a fixed text of the other side of the fence, which is a graveyard.
Since a graveyard is mentioned, I want
x graveyard
to give the description of that graveyard, but it gives me the default response that graveyard cannot be found. I tried placing it in scope but to no avail:
Instead of searching the fence:
say "Through the wrought iron fence, you see an ancient graveyard with an old building in the middle of it. Perhaps architected around the Gothic style? The iron fence runs the entire perimeter of the graveyard. An eerie feeling causes you to shudder as you peer into the graveyard.";
Before examining SE_graveyard in Thentis Road:
place SE_graveyard in scope;
say "[the other side of S_fence]";
âPlace X in scopeâ canât be used like that. It only works within a ââŠdeciding the scope ofâŠâ activity. See examples and exercises in 18.29.
Or to put it another way, scope is used by the parser.
By the time an âexamining SE_graveyardâ action exists, the parser has already needed to check if the word âgraveyardâ refers to anything the player can seeâwhich means itâs too late to change the scope now.
Iâve read through the scope section in the document, even ran the example verbatim. I get a misused âwhileâ clause. I think the problem is that graveyard is a room, and scope works with objects. As a test, I entered this from the IF manual verbatim (changing the nouns) on a line by itself:
After deciding the scope of the player while at Thentis Road:
place the SE_graveyard in scope.
This syntax (âwhile inâ) used to be part of Inform, but was removed a long time ago. Unfortunately the documentation wasnât changed consistently to reflect this. Similar documentation bugs have been reported before.
This is frustrating. All I want to do is get the same response when the player LOOKS THROUGH DOOR as he does when he examines what he sees through the door. They should be synonyms. It seems that Inform leads one right up to that point, but then drops the ball. Any help as to how I can give the description of the graveyard from both LOOKING and EXAMINE commands? The big difference is that the graveyard is a room that seems to be out of scope.
St John,
Can you direct me to how a room can be placed into scope? I didnât find it in the docs, and the compiler continues to give me an error on that point.
You almost had the right syntax in your post above. As mentioned, the documentation is unfortunately wrong where it says âwhile in the Cloakroomâ; the right syntax is âwhile the location isâ.
So, this works as a basic version or foundation:
Thentis Road is a room. "This is Thentis Road. Over in the graveyard, you see [a list of things in SE_Graveyard]."
SE_Graveyard is east of Thentis Road. "The graveyard is a gloomy place."
Understand "graveyard" as SE_Graveyard.
The tomb is in SE_Graveyard. The description of the tomb is "A big family tomb."
After deciding the scope of the player while the location is Thentis Road:
place SE_Graveyard in scope.
Test me with "x graveyard/x tomb".
The player can examine the graveyard and the tomb from Thentis Road, because we have placed the graveyard and its contents in scope.
This can be extended or changed in various ways, depending on whether you need to display the exact state of the graveyard dynamically, including mobile objects.
For example, you can add something like this:
Instead of examining SE_Graveyard, describe locale for SE_Graveyard.
See also the other examples beneath section 18.29 in the docs.
Thanks for these tips. I never would have thought âviewâ was a thing, but I can try the scenery approach. Also, I am not familiar with âlocaleâ. Iâll look into that.
Thanks all.
Nothing special about âviewâ hereâitâs just the name Iâm giving to a new object.
In other words, Iâm creating a piece of scenery called the âview of the graveyardâ. Since this bit of scenery is in Thentis Road, itâll automatically be in scope, and the player can examine it. Then you can make that examining do whatever you want.
Daniel,
The problem isnât the description. It is that there is no noun for examining. Players are not going to say âview of graveyardâ, theyâre going to say âexamine graveyardâ or look at graveyard". Even if they knew about âviewâ, they should still be able to âexamine graveyardâ since they were told there was a graveyard when they entered âlook through fenceâ. Since the noun canât be found, the parser kicks out and nothing gets executed except the default âcanât find a nounâ error message.
Players are not going to say âview of graveyardâ, theyâre going to say âexamine graveyardâ or look at graveyard".
If the player types EXAMINE GRAVEYARD, Inform will understand that as examining the âview of graveyardâ item, unless there is another conflicting graveyard in scope.
You can also add The printed name of the view of the graveyard is "graveyard" to make sure that the âview of the graveyardâ is always referred to as âthe graveyardâ in any output text. That way you get âYou see nothing special about the graveyardâ rather than âYou see nothing special about the view of the graveyard.â
Yep, as Petter says, the players can use any word in an objectâs name to refer to it. So having âa view of the graveyardâ lets the player X GRAVEYARD.
Thentis Road is a room. The Graveyard is a room. The iron gate is a door. It is north of Thentis Road and south of the Graveyard.
A view of the graveyard is scenery in Thentis Road. "This is the description of the graveyard as seen from the road."
Instead of searching the gate, try examining the view.
Thentis Road
In Thentis Road you can see an iron gate.
>x graveyard
This is the description of the graveyard as seen from the road.
In general, scenery is a good way to make something that can be examined, but doesnât show up in room descriptions or TAKE ALL or the like. Very convenient for background things.