Hello again! Had i known the kinds of nightmares that dealing with dark rooms in Inform7 would cause, i might not have planned a bunch of puzzles around them.
i want the player to be able to bumble around the game’s rooms in the dark. That means that i need to be able to describe rooms, individually and uniquely, when they are dark.
As usual, i have reached the end of my tether attempting this, and have exhausted online resources.
Not sure what kind of spooky voodoo goes into describing (or describing the description of) rooms, but here’s the current weirdness:
[spoiler][code]Rule for printing the description of a dark room:
say “[printed name]”; [this is a testing measure, and weird stuff happens - see below]
if the room is the Kitchen:
say “[darkKitchen]”;
otherwise if the room is the Den:
say “[darkDen]”;
To say darkKitchen:
say “It’s pitch black in here, but it smells like the kitchen.”;
To say darkDen:
say “You can’t see a thing, but the squish of shag carpet between your toes confirms that you’re in the living room”;[/code][/spoiler]
Seems kludgy, right? Believe me, i tried a lot of more level-headed stuff before i got here. Here’s what happens:
So here’s my big fat question:
i am saying “Rule for printing the description of a dark room,” and the subject of that rule appears not to be the room, but the cardinal direction that brought me into the room. That seems to be why my earlier, saner attempts at this failed, like this one:
[spoiler][code]A room has some text called dark description.
Rule for printing the description of a dark room:
[none of these worked]
say [dark description];
say “[dark description]”;
say [dark description of the room];
say “[dark description of the room]”;
say [room name][dark description];
try describing the room [sometimes i added “instead”];
try looking at the room;
try printing the dark description of the room;
try printing the dark description of the noun;[/code][/spoiler]
In the rare case where one of these lines would survive compilation, i would enter the room and encounter a run-time error, essentially saying that “north” was not allowed to have a property called dark description.
i come from a programming background, so i’m trying to see the Matrix here… and from what i can tell, a reference to the room is not being passed to this rule, but rather, a reference to the direction traveled to get there.
The only documentation examples i’ve seen about working with dark rooms tell me how to either override the description of ALL dark rooms, or how to add a light to a dark room so that the player can see. Neither of these are suitable for what i’m trying to do. What vocab/understanding am i missing to tackle this problem?