Hello!
Not sure if this is making things more complicated than it needs to be, (hint: yes) but I’m trying to set up varying descriptions for floors in different rooms en masse. I’ve tried a few different methods, and this is the one I thought should most work, but it’s getting caught on the gravel (no pun intended).
I haven’t yet handled the floor/ground indoor/outdoors issue, but that’s for later.
Any advice or recommended examples greatly appreciated.
The Grounds are a region.
The Great Lawn is a room in The Grounds. "The grass stretches for miles."
The Rough Driveway is a room in The Grounds. "The driveway stretches to the main road." The Rough Driveway is west of the Great Lawn.
The Sky is a backdrop. "Fluffy clouds look painted on." Understand "sky" and "clouds" as the sky. The sky is in the Grounds.
[to do: fix ground terrain]
Test flooring with "x ground / x grass / go w / x ground / x gravel"
Terrain is a kind of value. The terrains are paved, gravel, grass, carpet, stone, and wood. Rooms always have a terrain. The terrain of a room is usually grass.
The Variable Ground is a backdrop. "Nothing has been updated." Understand "ground", "floor", "grass", "gravel", and "dirt" as the Variable Ground. The Variable Ground is in the Grounds. The printed name of the Variable Ground is "ground".
Before examining the Variable Ground:
if the terrain is gravel:
Now the description of the Variable Ground is "The gravel is crunchy underfoot and as pale as bleached bone.";
continue the action;
otherwise if the terrain is grass:
Now the description of the Variable Ground is "The grass is pristinely manicured. There has not been an errant dandelion here for centuries.";
continue the action;
otherwise:
say "There's nothing important on the ground right now.";
The terrain of the Great Lawn is grass.
The terrain of the Rough Driveway is gravel.
The problem is in the line: if the terrain is gravel
As a rule of thumb, Inform rarely understands the “the” in such conditions like we do, unless it is further specified. In most cases, it will be treated as if you had written “a”, so Inform checks “if a terrain is gravel”, which evaluates to true.
You need to check for the terrain of the location:
if the terrain of the location is gravel
(And similarly for the grass check further below, of course.)
“The location” is shorthand for “the location of the player”.
As a side note, you could also, instead of using a Before examining rule, put everything into a conditional in the description of the Variable Ground, as in:
The description of the Variable Ground is "[if the terrain of the location is gravel]The gravel is crunchy underfoot and as pale as bleached bone[otherwise if the terrain of the location is grass]The grass is pristinely manicured. There has not been an errant dandelion here for centuries[otherwise]There's nothing important on the ground right now[end if]."
Others will probably chime in with alternatives or further suggestions for optimization, but I just wanted to clear up the immediate obstacle.
It might be easier to make a subkind of backdrops, and make several of them, and associate each with a region.
The Grounds are a region.
a terrain is a kind of region.
pavementy, gravelly, grassy, carpeted, stony, and wooden are terrains.
pavementy, gravelly, grassy, carpeted, stony, and wooden are in the Grounds.
The map region of a room is usually grassy.
The Great Lawn is a room. "The grass stretches for miles."
The floor is a kind of backdrop.
The description of a floor is usually "There's nothing important on the ground right now.".
Understand "floor", "ground" as a floor.
The gravel is a floor. "The gravel is crunchy underfoot and as pale as bleached bone.".
The gravel is in gravelly.
The grass is a floor. "The grass is pristinely manicured. There has not been an errant dandelion here for centuries.".
The grass is in grassy.
The Rough Driveway is a room in gravelly. "The driveway stretches to the main road." The Rough Driveway is west of the Great Lawn.
With the above, rooms have grass floors by default and in commands, any of “grass”, “ground”, “floor” can refer to it. But the driveway is in gravelly, so, there, any of “gravel”, “ground”, “floor” can refer to it.
This approach makes it fairly straightforward to fine-tune what words can refer to what kinds of floor where.