Inform 7 : "Going nowhere" fast

Here’s the problem: I have a set of three rooms (Empty, North, and South Beaches) that I’ve included in a region called the Shoreline. I noticed that the “Instead of going nowhere…” message for the region (commented out in the source code below right after the ***) overrides the “Instead of going nowhere…” message that I’ve designated for two of the individual rooms (North Beach and South Beach) in that region.

[code]“On the Beach 01” by Jay Goemmer

The story headline is “An Interactive Example”.

When play begins:
say “Introductory text.[paragraph break]”.

Instead of going up when the location is North Beach:
try going north instead.

Instead of going north when the location is North Beach:
say “[line break]The lava rock cliff is much too steep for you to scale.”

Instead of going up when the location is South Beach:
try going south instead.

Instead of going south when the location is South Beach:
say “[line break]You try climbing the lava rock cliff, to no avail.”

Shoreline is a region.
Empty Beach and South Beach and North Beach are in the Shoreline.

Instead of going west in the Shoreline, say “[line break]The water’s too cold.”

[*** Instead of going nowhere in the Shoreline, say “[line break]You wander aimlessly down the beach, but get nowhere fast.” ]

[Starting location must be declared as a room.]

Empty Beach is a room. “A white sand beach stretches north, south and east.”

North Beach is north of Empty Beach. “Here the sand peters out, leaving black volcanic rock to the north.”

South Beach is south of Empty Beach. “The southern end of the white sand beach gives way to a wall of rock.”

The Tall Cliff is fixed in place in South Beach. The printed name is “tall cliff”. “A cliff that’s too steep and too tall to climb towers over the beach.” The description is “[line break]The cliff made of distinct layers of lava flows is now a black, hard wall of rock.” Understand “rock”, “volcanic”, “lava”, “black”, “wall”, “stone” as Tall Cliff.

East Beach is east of Empty Beach. “The shoreline is west of this part of the beach, which also stretches away to the north and south.”

[3.3. One-way connections, noted below.]
East Beach is east of South Beach. East Beach is east of North Beach.
North Beach is north of East Beach. South Beach is south of East Beach.[/code]
I suppose I could hand-code messages for each of the individual rooms for the region’s “Instead of going nowhere…” message. That’s not a very elegant solution.

Please share your thoughts and comments regarding a possible “best practice” here.

Thanks and cheers,

I tried something on a hunch and it solved the problem.

In the case of the individual rooms, you’re currently saying things like:

“Instead of going up when the location is North Beach:”

If you replace the ‘when the location’ with plain old ‘in’, like this…

“Instead of going up in North Beach:”

  • the individual room level messages now kick in before the region level ones. Note that you’re already addressing the region movement restrictions by the IN method rather thatn the WHEN method.

Why did this work? I suspect someone will come along with an exact answer, but my guess is that using the ‘when’ construction is internally different to Inform in a way that causes it to be checked later than the straight up ‘in’ construction.

Why did I try it? After gaining some experience playing with slightly different forms of wording, especially where ‘going’ actions are concerned, you’ll find there are subtle differences between them (usually when something’s not working and you wonder why.) So it’s on my radar as a source of glitches now. Just the kind of thing you’ll absorb as you keep at it!

  • Wade

Actually, Inform 7 considers the IN method to be more specific than the WHEN method. This is because using “when” can be used for any condition not just rooms and is therefore a more general restriction than “in”. See “18.18. The Laws for Sorting Rulebooks” in The Inform 7 Documentation for more details.

My guess would be simply that Inform is treating a “going somewhere in a place” rule as more specific than a “going somewhere when some condition”. That kind of makes sense; since a “when” condition can contain anything, Inform has no idea how specific it might be without actually testing it, so it’s assuming that it probably isn’t that specific.

In fact, I think this is actually documented in the manual, in section 18.18, The Laws for Sorting Rulebooks (formatting added for clarity):

So a “going somewhere in a place” gets a score of 2 according to rule I (one for the place and one for the destination), while a “going somewhere when some condition” rule only scores 1, and so is considered less specific. Rule II does say that a “going somewhere when some condition” rule still beats a plain old “going somewhere” (and a “going somewhere in a place when some condition” would beat all of them).

Dear Wade,

Ah, very good! This probably happened when I coded the region and the rooms in widely separated sessions, or as my parents used to say, “in fits and starts.” (chuckling)

Thanks for the encouragement, as well as the extra set of objective eyes! :wink: :smiley:

Cheers,

Dear climbingstars and vyznev,

Thanks for the insights and pointing me to the pertinent documentation. I’ve read and re-read that section countless times in recent weeks, and I just couldn’t tease out the “sneaky bits” that I needed to make it work properly.

I could tell that one section of code appeared to override the other, but I was too close to see it. Thanks again! :wink: :smiley:

Cheers,

Thanks to everyone for your help on my “going nowhere” dilemma! Your solutions worked perfectly.

However, I discovered another coding difficulty along these lines. When I type IN at the command prompt, it gives me the proper “going nowhere” response. But typing OUT gives me the library response, “But you aren’t in anything at the moment.”

I’ve perused “Writing with Inform” and the “Recipe Book,” as well as Jim Aikin’s “Inform 7 Handbook.” All three of them seem to indicate the following command should work:

Instead of going outside in the Shoreline: try going west instead.

That line is commented out in the source code below. A little help, here? (chuckling) Thanks in advance.[code]“On the Beach 02” by Jay Goemmer

The story headline is “An Interactive Example”.

When play begins:
say “Introductory text.[paragraph break]”.

Instead of going up in North Beach:
try going north instead.

Instead of going north in North Beach:
say “[line break]The lava rock cliff is much too steep for you to scale.”

Instead of going up in South Beach:
try going south instead.

Instead of going south in South Beach:
say “[line break]You try climbing the lava rock cliff, to no avail.”

Shoreline is a region.
Empty Beach and South Beach and North Beach are in the Shoreline.

Instead of going nowhere in the Shoreline, say “[line break]You wander aimlessly down the beach, and actually get somewhere for a change.”

[*** Instead of going outside in the Shoreline:
try going west instead. ]

Instead of going west in the Shoreline, say “[line break]The water’s too cold.”

[Starting location must be declared as a room.]

Empty Beach is a room. “A white sand beach stretches north, south and east.”

North Beach is north of Empty Beach. “Here the sand peters out, leaving black volcanic rock to the north.”

South Beach is south of Empty Beach. “The southern end of the white sand beach gives way to a wall of rock.”

The Tall Cliff is fixed in place in South Beach. The printed name is “tall cliff”. “A cliff that’s too steep and too tall to climb towers over the beach.” The description is “[line break]The cliff made of distinct layers of lava flows is now a black, hard wall of rock.” Understand “rock”, “volcanic”, “lava”, “black”, “wall”, “stone” as Tall Cliff.

East Beach is east of Empty Beach. “The shoreline is west of this part of the beach, which also stretches away to the north and south.”

[3.3. One-way connections, noted below.]
East Beach is east of South Beach. East Beach is east of North Beach.
North Beach is north of East Beach. South Beach is south of East Beach.[/code]

The command “out” is interpreted as the exiting action rather than the action of going outside. (Exiting is the action you’d perform to get out of a container; going outside is the going action with “outside” as the noun.) For sanity’s sake, when you’re not exiting a container and when there’s a room in the outside direction from your current location, the Standard Rules converts this to going outside. This happens through the “convert exit into go out” rule in the Standard Rules.

But in your case, there isn’t a room outside from the rooms in the shoreline, so the action doesn’t get converted to going outside, and the message for exiting when you aren’t in a container runs instead of your “instead of going outside” rule. Typing “actions” before you type “out” will tell you this. (For a headscratcher, try “go out” instead of “out”; it works as you’d want.)

I can think of two ways to fix this:

The simplest one would be to intercept exiting in the Shoreline too:

Instead of exiting in the Shoreline when the container exited from is the location: try going west instead.

You need the “when” clause so this doesn’t prevent you from exiting any enterable containers you have in the Shoreline.

You could also change the “convert exit into go out” rule so that it also converts exiting into going out when in the Shoreline and not in an enterable container. Not sure if there would be any advantages to that approach.

matt,

You’re my coding superhero once again! Thanks for coming to the rescue. (Again.) :wink: :smiley:

Cheers,

The advantage of this method would be to allow rules like this to work as expected.

Check going outside in the Chamber: try going north instead.

This would give “But you aren’t in anything at the moment.” instead of going north.

It is used in the extension “Modified Exit by Emily Short”.