§18.15. Issuing the response text of something

1. When it happens. When Inform prints a text marked with a response letter (A), (B), (C), ..., in a rule making use of them. For example, in this rule:

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.

Or, less directly,

let R be the print empty inventory rule response (A);
say "To be frank: [text of R].";

2. The default behaviour. To print the current textual value of the response, making any substitutions in the ordinary way.

3. Examples. This activity is not the best way to amend responses or make them dynamic; the whole idea of responses is that they can be changed just as if they were text variables. This activity should be used only if it's important to amend blocks of responses in some systematic way.

(a) With that said, some interesting effects can be achieved. This is a way to see which responses are being printed, for example:

Before issuing the response text of a response (called R): say "[R]: ".

whence:

>WAIT
standard report waiting rule response (A): Time passes.

(b) And this intercepts the activity in order to re-run it in each of the six viewpoints. (Note the way a variable is used to prevent the rule from applying to all of those re-runs as well.)

The response inhibition is initially false.

Rule for issuing the response text of a response (called R) when the response inhibition is false:
    now the response inhibition is true;
    let the current viewpoint be the story viewpoint;
    repeat with P running through narrative viewpoints:
        now the story viewpoint is P;
        say "[P]: [text of R][command clarification break]";
    now the story viewpoint is the current viewpoint;
    now the response inhibition is false.

With that in place,

>EAST
first person singular: I can't go that way.
second person singular: You can't go that way.
third person singular: He can't go that way.
first person plural: We can't go that way.
second person plural: You can't go that way.
third person plural: They can't go that way.


arrow-up.pngStart of Chapter 18: Activities
arrow-left.pngBack to §18.14. Grouping together something
arrow-right.pngOnward to §18.16. Printing room description details of something

If we want to change individual responses to player action, then the best thing to do is to use the response facility to modify those selections, as shown in the chapter on Responses.

However, suppose what we want is to give the parser a speech impediment that slightly alters all of the responses it issues. For this purpose, we might need to do a bit of text replacement...

paste.png "Wesponses"

The Office is a room. Barry Kripke is a man in the Office.

The response inhibition is initially false.

Rule for issuing the response text of a response (called R) when response inhibition is false:
    now response inhibition is true;
    let output be "[text of R]";
    now response inhibition is false;
    replace the text "r" in output with "w";
    replace the text "R" in output with "W";
    say "[output]".

Test me with "i / x barry / listen / waffle / jump"

Notice that this doesn't affect the printed names of objects in the room description or other kinds of output text -- only those that are issued by the response mechanism.

It would also not work to try to give our parser a nervous personality by simply adding "Um, " to the beginning of each response, because responses are not guaranteed to be full standalone sentences. For example, we could imagine writing

Rule for issuing the response text of a response (called R) when response inhibition is false:
    now response inhibition is true;
    let output be "Um, [text of R]";
    now response inhibition is false;
    say "[output]".

but here is what the room description would say as a result:

Office
Um, You Um, can see Barry KripkeUm, here

*ExampleWesponses
Parser messages that are delivered with a speech impediment.

If we want to change individual responses to player action, then the best thing to do is to use the response facility to modify those selections, as shown in the chapter on Responses.

However, suppose what we want is to give the parser a speech impediment that slightly alters all of the responses it issues. For this purpose, we might need to do a bit of text replacement...

paste.png "Wesponses"

The Office is a room. Barry Kripke is a man in the Office.

The response inhibition is initially false.

Rule for issuing the response text of a response (called R) when response inhibition is false:
    now response inhibition is true;
    let output be "[text of R]";
    now response inhibition is false;
    replace the text "r" in output with "w";
    replace the text "R" in output with "W";
    say "[output]".

Test me with "i / x barry / listen / waffle / jump"

Notice that this doesn't affect the printed names of objects in the room description or other kinds of output text -- only those that are issued by the response mechanism.

It would also not work to try to give our parser a nervous personality by simply adding "Um, " to the beginning of each response, because responses are not guaranteed to be full standalone sentences. For example, we could imagine writing

Rule for issuing the response text of a response (called R) when response inhibition is false:
    now response inhibition is true;
    let output be "Um, [text of R]";
    now response inhibition is false;
    say "[output]".

but here is what the room description would say as a result:

Office
Um, You Um, can see Barry KripkeUm, here

If we want to change individual responses to player action, then the best thing to do is to use the response facility to modify those selections, as shown in the chapter on Responses.

However, suppose what we want is to give the parser a speech impediment that slightly alters all of the responses it issues. For this purpose, we might need to do a bit of text replacement...

paste.png "Wesponses"

The Office is a room. Barry Kripke is a man in the Office.

The response inhibition is initially false.

Rule for issuing the response text of a response (called R) when response inhibition is false:
    now response inhibition is true;
    let output be "[text of R]";
    now response inhibition is false;
    replace the text "r" in output with "w";
    replace the text "R" in output with "W";
    say "[output]".

Test me with "i / x barry / listen / waffle / jump"

Notice that this doesn't affect the printed names of objects in the room description or other kinds of output text -- only those that are issued by the response mechanism.

It would also not work to try to give our parser a nervous personality by simply adding "Um, " to the beginning of each response, because responses are not guaranteed to be full standalone sentences. For example, we could imagine writing

Rule for issuing the response text of a response (called R) when response inhibition is false:
    now response inhibition is true;
    let output be "Um, [text of R]";
    now response inhibition is false;
    say "[output]".

but here is what the room description would say as a result:

Office
Um, You Um, can see Barry KripkeUm, here