Chapter 17: Activities
17.30. Supplying a missing noun/second noun

1. When it happens. (Two different activities here, but identical except for applying to different nouns.) Suppose that, because of an instruction to Understand something even though it would be lacking a noun - say, 'Understand "take" as taking.' - an incomplete action is generated, one which is required to have a noun, but doesn't. "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?"


357
* Example  Latin Lessons
Supplying missing nouns and second nouns for other characters besides the player.

RB

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:

"Latin Lessons"

The Latin Studio is a room. Rick is a man in the Studio.

A dance-name is a kind of thing. Argentine tango, samba, merengue, cha-cha, street salsa are dance-names.

Dancing is an action applying to one visible thing. Understand "dance [any dance-name]" as dancing. Understand "dance" as dancing.

Rule for supplying a missing noun while an actor dancing:
    now the noun is street salsa.

Report someone dancing:
    say "[The actor] dances a few steps of [the noun] for you."

Report dancing:
    say "You dance a few steps of [the noun]."

Persuasion rule for asking someone to try dancing: persuasion succeeds.

Test me with "dance / dance samba / rick, dance / rick, dance merengue".

358
* Example  Minimal Movement
Supplying a default direction for "go", so that "leave", "go", etc., are always interpreted as "out".

RB


PreviousContentsNext