1
0
Fork 0
mirror of https://github.com/ganelson/inform.git synced 2024-07-05 16:44:21 +03:00
inform7/resources/Documentation/Examples/Wesponses.txt
2019-03-16 13:12:11 +00:00

40 lines
1.7 KiB
Plaintext

* Issuing the response text of something
(Altering response text programmatically; Wesponses)
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...
{*}"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