Inform 7 Home Page / Documentation


§14.10. Responses

Most of the text which the player sees is drawn from the source, but mixed in with this are messages apparently added by Inform itself - usually in the form of short sentences saying that something has been done, or that something can't be done. Such pieces of text are called "responses", because they are almost always replies to commands. For example:

> EAST
You can't go that way.

> JUMP
You jump on the spot.

Responses like this, which don't appear anywhere in the source text, come from one of the extensions being used; most often from the Standard Rules, the "extension" which is automatically included in every project. The SR contain many small rules, and almost all of these are capable of producing one or two standard responses. These are labelled with the rule's name and then a bracketed letter - (A), (B), (C), ... as needed so that every response has its own unique name. There's nothing very mysterious about how this is done. For example, here is a rule with one response:

Carry out taking inventory (this is the print empty inventory rule):
    if the first thing held by the player is nothing,
        say "[We] [are] carrying nothing." (A) instead.

which makes the familiar text "You are carrying nothing." a response named:

print empty inventory rule response (A)

These names are actually values, belonging to the kind "response". Because of that, if we try this:

say "Hmm: [print empty inventory rule response (A)]"

Inform will produce

Hmm: print empty inventory rule response (A)

since we gave Inform a value to print, and that's just what it then did. As an alternative:

say "[text of (response)]"

This text substitution writes out the current text of the given response.

Thus,

say "Hmm: [text of print empty inventory rule response (A)]"

produces

Hmm: You are carrying nothing.


arrow-up.png Start of Chapter 14: Adaptive Text and Responses
arrow-left.png Back to §14.9. Verbs as values
arrow-right.png Onward to §14.11. Changing the text of responses