1
0
Fork 0
mirror of https://github.com/ganelson/inform.git synced 2024-07-16 22:14:23 +03:00
inform7/resources/Documentation/Examples/Proposal.txt

84 lines
3.5 KiB
Plaintext
Raw Normal View History

Example: ** Proposal
Location: Conditions and questions
RecipeLocation: Saying Simple Things
Index: Asking the player a Yes/No question
Description: Asking the player a yes/no question which they must answer, and another which they may answer or not as they choose.
For: Z-Machine
2019-02-05 02:44:07 +02:00
2023-05-14 08:08:43 +03:00
Suppose we want to ask the player a question where they might say yes or no in response. There are two possible forms of this: the modal question where the player must pick one to proceed, and the non-modal question where they might also type other verbs.
2019-02-05 02:44:07 +02:00
{*}"Proposal"
The story genre is "A Worked Example about Yes/No Questions".
Section 1 - Asking a Modal Yes/No Question
2019-02-05 02:44:07 +02:00
When play begins:
2019-02-05 02:44:07 +02:00
say "Do you like Mr Spruce? ";
if player consents, now Spruce is handsome;
otherwise now Spruce is ugly;
say paragraph break.
{**}Section 2 - Mr Spruce's Non-Modal Question
2019-02-05 02:44:07 +02:00
Use full-length room descriptions.
The Conservatory is a room. "You are in a room full of plants."
2019-02-05 02:44:07 +02:00
Mr Spruce is a man in the Conservatory. Mr Spruce can be apprehensive or calm. Mr Spruce is calm. Mr Spruce can be handsome or ugly.
At 9:02 AM: say "Mr Spruce flings himself to his knees and implores you to become his lawfully wedded wife.";
now Mr Spruce is apprehensive;
Mr Spruce gives up in two minutes from now.
At the time when Mr Spruce gives up:
say "Mr Spruce sighs heavily, seeing that you don't intend to reply. 'Never mind, my dear, I'll ask later. Perhaps I should have spoken to your Papa first... yes, a gently-bred female... no wonder...'";
now Mr Spruce is calm;
Mr Spruce departs in one minute from now.
At the time when Mr Spruce departs:
if the player can see Mr Spruce, say "Mr Spruce takes his leave of you.";
otherwise say "Mr Spruce pokes his head in to say that he is leaving.";
end the story saying "Well, that is over..."
2019-02-05 02:44:07 +02:00
Instead of saying yes in the presence of an ugly apprehensive Mr Spruce:
now Mr Spruce is calm;
say "Remembering what your mother said to you about the stock exchange and Dear Papa, you close your eyes and accept Mr Spruce.";
end the story saying "Alas for your maiden hopes."
Instead of saying yes in the presence of a handsome apprehensive Mr Spruce:
now Mr Spruce is calm;
say "You are silent with delight for a moment before you say yes, yes!";
end the story saying "How Genevieve Stubbs will cry!"
Instead of saying no in the presence of an ugly apprehensive Mr Spruce:
now Mr Spruce is calm;
say "Gently you inform Mr Spruce that it is impossible. He seems less deflated than you had expected.";
end the story saying "Odd, that..."
Instead of saying no in the presence of a handsome apprehensive Mr Spruce:
now Mr Spruce is calm;
say "You lower your eyes and refuse petulantly, hoping to stir him to a more ardent repetition of these same requests. But then -- alack! -- he says 'I see how it is!' in a strangled voice, and strides from the room!";
end the story saying "A fatal error!"
2019-02-05 02:44:07 +02:00
And since the player might SAY YES TO SPRUCE, we had better reroute the relevant options:
{**}Instead of answering Mr Spruce that "no", try saying no.
Instead of answering Mr Spruce that "yes", try saying yes.
2019-02-05 02:44:07 +02:00
Instead of asking Mr Spruce to try saying yes, try saying yes.
2019-02-05 02:44:07 +02:00
Instead of asking Mr Spruce to try saying no, try saying no.
2019-02-05 02:44:07 +02:00
Instead of saying sorry, try saying no.
2019-02-05 02:44:07 +02:00
Instead of asking Mr Spruce to try saying sorry, try saying no.
2019-02-05 02:44:07 +02:00
Instead of answering Mr Spruce that "sorry", try saying no.
2019-02-05 02:44:07 +02:00
Test me with "z / z / z / yes".
Test more with "z / z / z / no".