I was just reading through an old argument about Smarter Parser in which Hannes reasonably enough raged against “That noun did not make sense in that context.”
And I thought, maybe the problem here is that the message doesn’t really give any feedback. It doesn’t say which noun doesn’t make sense in which context. How easy would it be to fix this? It seems as though this arises when the grammar token contains “[any]” (so it allows reference to things that aren’t in scope) but the player hasn’t entered something that referes to anything matching the grammar token.
It seems to me there are two cases here; the player has entered something that’s not in the dictionary (“go to foo” when “foo” isn’t defined) or is referring to a noun that doesn’t match the token – say “go to Jordan” when the “go to” command only accepts rooms and Jordan is a person. The first case might be handled by Unknown Word Error or something similar. Is there a way to catch errors of the second kind and say “You’re trying to go to Jordan, but you can only use that command with the names of rooms, and Jordan isn’t a room”?
I think so, but it’s both expensive and possibly spoilery.
You’d have to re-match the command against every object in the game. So that’s expensive. (The point of “go to [any room]” is that the parser only has to match against rooms.)
And then there’s the question of what game objects the player is supposed to know about. Some objects may exist only for internal code reasons. (E.g. I have a room called “Abstraction” in my current game, but it’s just a place to stash certain off-stage objects.)
Is there no way, perhaps with an I6 parser hack, to recover the part of the player’s command by which they referred to the noun that did not make sense in the context? It seems like it’s possible to isolate cases in which the player referred to the wrong kind of noun – just change the “Unknown Word Error” extension so that the don’t know that word rule fires for the the noun did not make sense in that context error as well as the can’t see any such thing error. But I take it once that happened, there’s no way to recover the bit that messed up?
It does seem to me that it’s worth modifying Unknown Word Error so that it catches both kinds of error (are there any other errors triggered by unknown words)? I’d have to think about whether there could be a more helpful error message. I suppose an enterprising author could use the action-to-be to craft a special error message for any action that uses an “[any thing]” or “[any room]” token; so if the action-to-be is going remotely, the game could say “The GO TO command must be followed by the name of a location; other sorts of things like people and objects will not work after the GO TO command” (or something like that).
(Aside: The name of the parser error is “the noun did not make sense in that context error” but the error message says “That noun did not make sense in this context.” This is mildly annoying.)
What you can do is tell Inform to understand, say, “go to [any person]” or even “go to [any thing]” as mistakes, with appropriate error messages. For example:
Teleporting to is an action applying to one thing.
Understand "go to [any room]" as teleporting to.
Understand "go to [any thing]" as a mistake ("Your teleporter can only take you to a location, not to an object.")
Carry out teleporting to a room (called the place): move the player to the place.
Lecture Hall is a room.
Lobby is south of the Lecture Hall.
Cafeteria is west of the Lobby.
Professor Smith is a man in the Lecture Hall.
Test me with "go to smith / go to cafeteria".
I was taking that for granted.
This is the situation: the player has typed “GO TO JORDAN”. The parser attempts to match the snippet “JORDAN” against every room (perhaps just every visited room). This fails. It is now time for the error message. Now what?
To get the result you want, the parser will have to go back and try to match “JORDAN” against every object in the game. Then it might pick up a person object Jordan Foo. But if the player has never met Jordan Foo, this could be inappropriate, so you’d want to limit it to checking known objects. That pulls in Epistemology.
Also, there are cases that I think you’ve missed. If the player types “GO TO BLUE BATHROOM”, this would trigger that error message even if the words “blue” and “bathroom” are both known. (Say there’s a blue key and a pink bathroom in the game, but no blue bathroom.)
Ah, good catch.
I think it does highlight how unsatisfactory the message is though. If I type “go to blue bathroom” and get the message, what have I learned? That “blue bathroom” makes sense in some context, but not this one? (That’s the implicature the message sends.) Maybe something like “I understand the verb but not the whole sentence” would fit better.
It is very much a fallback error!
The best plan is: if you set up a verb with an “any”-scoped token, customize that error message for the verb. (The “noun did not make sense in that context” error.)
- You never seen any such location.
- You don’t remember any such thing.
- You’ve never fantasized about any such person.(*)