Player's Surroundings Compared to Location

Hey all. So consider the following code:

[code]The integer is a number that varies.
The integer is 10.

A distance is a kind of value.
The distances are near, right here, and far.

The Learning Lab is a room. “The value of integer is [integer]. Location = [location]; Player surroundings = [the player’s surroundings]; Score = [score]; Turn count = [turn count]; Time of day = [time of day].”

Instead of waiting when the integer is 10:
say “In [the player’s surroundings].”;
say “Integer has changed to 20.”;
now the integer is 20;
now the command prompt is “[the player’s surroundings] >”.[/code]
This was an example that one of my younger classes put together as they tried to understand bits of Inform. The key thing they noticed is that the substitution [the player’s surroundings] in the room description does not print anything at all.

A few questions were asked that I’m not entirely sure of the answers to. Specifically:

  • Why is there “player’s surroundings” when “location” seems simpler?
  • Is there a reason to use one over the other?
  • Why doesn’t “[the player’s surroundings]” work in description text for a room but does work elsewhere?

There are two differences: firstly, [the player’s surroundings] prints “Darkness” when the room is dark. Secondly, if the player is inside a closed and opaque container, it prints the container’s name instead of the room’s name. (See ch. 8.3. in the manual.)

That seems to be a bug: the text is empty only before the first turn. If you look again or return to the room it prints correctly in the room description. Looks like whatever mechanism that sets the value runs first time only after the initial room description is printed, when it should arguably be the other way around.

Excellent. Thanks for the quick response. The class was in fact using chapter 8 so they did see the chapter you are talking about, but there’s nothing there that compares or contrasts “location” with “the player’s surroundings”, which is probably why the necessary correlations were not made. (That includes myself.) I’m updating the training material accordingly.

Digging into code: “the player’s surroundings” is not set, it’s computed. It’s intentionally suppressed during the “when play begins” phase. I think this is because it’s used in the status line. In games that have when-play-begins interactivity (asking for your name or gender, asking whether you need IF help, etc) Inform defaults to not showing the initial room in the status line during that phase.

That’s reasonable; I just filed a bug report but it might be moot now that I see the documentation even says it’s intended for use in the status line only.

Yeah, although it might be good to state something like that more clearly in the documentation, no?

While this example of “the player’s surrounding’s” is presented in the context of the status line, nothing says it can only be used in that context. At best, the wording is potentially ambiguous. Turn count and score are also shown in this example but they can be used outside of the status line context.

On the other hand, since [location] and [the player’s surroundings] do clearly provide different information, I would assume there might be some use for it outside of the status line.