Inform 7 Home Page / Documentation
§18.32. Supplying a missing noun/second noun
1. When it happens. (Two different activities here, but identical except for applying to different nouns.) This happens when an Understand sentence fails to supply a noun for an action which requires one. For example, in the sentence 'Understand "seize" as taking.' - the "taking" action is incompletely specified, because it requires a noun, and there's no noun in the command to be understood.
Note that this is not what happens if it's the player who fails to supply the noun. That is, suppose the player types a half-finished command like TAKE, which can't be matched against (for example) 'Understand "take [things]" as taking.' because the player didn't name any thing(s). Typically a story will reply to such a command with a question asking for clarification, but sometimes it makes guesses about what was meant. The "supplying a missing noun" activity plays no part in this guesswork, and can't influence it: that's the task of the "does the player mean" rulebook.
Suppose we do have the first of these cases, then. "Supplying a missing noun" takes place to remedy the problem. It can either:
(i) Set a noun, printing text like "(presumably the black bag)" if it wants, in which case the action goes forward, though it is still subject to the full rules on accessibility exactly as any other action would be; or
(ii) Make no choice, in which case no action takes place and the player's command is rejected. If the activity printed nothing, Inform will produce a generic reply to the player that "You must supply a noun.".
2. The default behaviour. In the default grammar for Inform, only three such half-finished actions are ever Understood. One is "going" with no direction, for which this activity simply prints a refusal. The other two are the two undirected senses, "smelling" and "listening". In each case, the "supplying a missing noun" activity sets the noun to the current location: so, for instance, typing the bare command "listen" might generate the action "listening to the Shoreline".
3. Examples. (a) This is the definition Inform uses to make "listen" work as outlined above:
Rule for supplying a missing noun while listening (this is the ambient sound rule):
now the noun is the location.
(b) It can be elegant to allow second nouns to be dropped with habitual actions, or where the choice is obvious:
Understand "unlock [something]" as unlocking it with.
Rule for supplying a missing second noun while unlocking:
if the skeleton key is carried, now the second noun is the skeleton key;
otherwise say "You will have to specify what to unlock [the noun] with."
Note that, in order for our activity to succeed, we do need to supply a grammar line allowing the player to try "unlocking it with" using only one noun. Otherwise, the command "unlock something" will still produce the question "What do you want to unlock the door with?"
|Start of Chapter 18: Activities|
|Back to §18.31. Asking which do you mean|
|Onward to §18.33. Reading a command|
If we're defining actions for other characters to follow, we may want to include them in our "rule for supplying a missing noun". We can do this if we write our "while..." clause to apply to any actor, as follows:
Sometimes it would be nice to respond a little more sensitively to a vague command such as "leave" -- converting it, perhaps, to a "go out" command.
This particular situation is very slightly complicated by the existing rules about vague movement, but fortunately we can easily turn those off.