I was playing Jon Ingold’s A Colder Light recently, and it had got me thinking about a couple things. One is the integration of hyperlinks and a parser, which I mention only because it’s partly motivating my question, but we can set that aside. The other, though, is that the game makes heavy use of the verb DESCRIBE. DESCRIBE on the one hand can be taken as a straight synonym of EXAMINE, but, depending on the relationship between the player and PC, EXAMINE might be more aptly characterized as a subset of DESCRIBE. You could be perfectly sensible in think the PC can DESCRIBE things that are not objects in the game world that would be sensible to EXAMINE, etc… In other words, DESCRIBE could be divided into the subsets of the conventional EXAMINE and something for which a good synonym might be EXPLAIN, the latter of which one could implement along the lines of the I7 example using REMEMBER (15.13).
So, say what I’d like to do is this: implement a verb, DESCRIBE, that is EXAMINE if the noun that follows is an object, and but if the noun turns out to be an object, then try to EXPLAIN the same thing. I guess I could live with the other way around, where if what was DESCRIBE’d wasn’t a listed topic to EXPLAIN, the game would try to EXAMINE it. Does anyone have any thoughts on what would be the best strategy for trying to implement this in a game?
My suspicion is that the easiest way to do something like this would be to represent concepts with a new kind of object that is placed in scope when, and only when, the player is EXPLAINing. See 17.27 for the joys of scope.
The alternative, if you wanted to mix topics and objects in the same command, would involve use of reading the player’s command, matching it against a table of topics to see if it included any valid EXPLAIN topics, and then letting the action continue if it didn’t.
I happen to have this lying around in my Hadean Lands code…
This allows “examine” to work on in-scope objects (as usual), and also on concepts (anywhere in the game). “Describe” is a synonym for “examine”, so that’s covered. Then “recall” is set up to operate only on concepts.
Adding game-wide grammar to “examine” in this way changes the “You can’t see any such thing” error to “That noun doesn’t make sense in this context”. I have added a parser-error rule to change it back, and also handle the “recall” case.
The Kitchen is a room. "This is the room."
A concept is a kind of thing.
Joy is a concept. The description is "Joy is an emotion."
Understand "[any concept]" as "[concept-spec]".
Understand "examine [concept-spec]" as examining.
Recalling is an action applying to one visible thing.
Understand "recall [concept-spec]" as recalling.
Carry out recalling:
try examining the noun.
To decide what action name is the action-to-be:
(- action_to_be -).
Rule for printing a parser error when the latest parser error is the noun did not make sense in that context error:
if the action-to-be is:
-- the examining action: say "You can't see any such thing.";
-- the recalling action: say "Nothing comes to mind.";
-- otherwise: say "That noun did not make sense in this context."