"Questionable Revolutions"
Interrogative is a kind of value. The interrogatives are who, what, when, where, how, and why.
Current question is an interrogative that varies.
After asking someone about something: respond to the question. After answering someone that something: respond to the question.
After telling someone about something: say "You're here to ask questions."
Country is a kind of value. The countries are Czechoslovakia, Georgia, Sweden, Italy, Spain.
Table of Information
topic
|
date
|
place
|
definition
|
"velvet revolution"
|
1989
|
Czechoslovakia
|
"A bloodless revolution in Czechoslovakia, in which popular protests led to the resignation of the communist president Gustav Husak, and the election of Vaclav Havel in his place."
|
"rose revolution"
|
2003
|
Georgia
|
"A revolution in which President Eduard Shevardnadze was interrupted by protesters in the middle of his speech, and forced to flee."
|
"spanish revolution"
|
1936
|
Spain
|
"An anarchist and socialist movement during the Spanish civil war."
|
After reading a command:
if the player's command includes "[interrogative]", now the current question is the interrogative understood.
To respond to the question:
repeat through the Table of Information:
if the topic understood includes topic entry:
if the current question is what or the current question is who, say definition entry appropriately;
if the current question is when, say date entry appropriately;
if the current question is where, say place entry appropriately;
rule succeeds;
say "[The noun] shrugs."
Understand "ask [someone] [text]" as asking it about.
Comprehension is a kind of value. The comprehensions are vague, erroneous, and correct.
Table of Understanding
character
|
years
|
geography
|
general comprehension
|
Dr Tweedy
|
correct
|
correct
|
correct
|
Ms Finch
|
erroneous
|
erroneous
|
correct
|
Ms Clarion
|
vague
|
vague
|
erroneous
|
When play begins:
say "Here you are in the first class cabin, but no matter how fancy the seats are, you can still get bored circling over Zurich for three hours on end. To kill time, you and the other passengers are playing a trivia game, and the final topic is your specialty: revolutions."
First Class Cabin is a room. Dr Tweedy is a man in First Class. Ms Finch and Ms Clarion are women in First Class.
To say (year - a number) appropriately:
choose row with character of the noun in the Table of Understanding;
if years entry is correct:
say "'[year],' replies [the noun] promptly.";
increment the quiz score of the noun;
if years entry is erroneous:
let guess be a random number between 1900 and 2005;
say "'[guess]?' guesses [the noun], with an air of diffidence[if guess is the year]. Which is right, as it happens[end if].";
if guess is the year, increment the quiz score of the noun;
if years entry is vague:
let offset be a random number between -5 and 5;
let year be year + offset;
say "'I think [year]. About then. Close, anyway,' replies [the noun][if the offset is 0], getting it right[end if].";
if offset is 0, increment the quiz score of the noun.
To say (spot - a country) appropriately:
choose row with character of the noun in the Table of Understanding;
if geography entry is correct:
say "'[spot],' replies [the noun] promptly.";
increment the quiz score of the noun;
if geography entry is erroneous:
let guess be a random country;
say "'Er... [guess]?' says [the noun][if guess is the spot]. Which is of course correct[end if].";
if guess is the spot, increment the quiz score of the noun;
if geography entry is vague, say "'Europe,' replies [the noun] with confidence."
To say (explanation - some text) appropriately:
choose row with character of the noun in the Table of Understanding;
if general comprehension entry is correct:
say "'[explanation]'[paragraph break]";
increment the quiz score of the noun;
otherwise:
choose a random row in the Table of Information;
say "'[definition entry]'[paragraph break]";
if the definition entry is explanation:
say "[A random other person who is not the noun] looks surprised that this came out right.";
increment the quiz score of the noun.
A person has a number called quiz score. The quiz score of Tweedy is 48. The quiz score of Finch is 2. The quiz score of Clarion is 4.
Definition: a person is other if it is not the player.
When play begins:
now left hand status line is "T: [quiz score of Tweedy] F: [quiz score of Finch] C: [quiz score of Clarion]";
now right hand status line is "[time of day]".
Test me with "dr tweedy, where was the velvet revolution located / ms finch, when was the rose revolution / ms finch, what was the rose revolution / ms clarion, when was the spanish revolution / g / g / ms finch, when was the spanish revolution".
We have so far seen several ways to write conversational characters in Inform, and we will see more before the end of the manual. This naturally raises the question, which should we use? To which the answer is: it depends on the sort of game we're writing, and what we want our characters to do. The more rich and complex the system, the more likely that it will require a lot of content; if we add question types as well as keywords, for instance, we instantly multiply the number of responses we have to write by five or six. It is not worth doing this unless there is some corresponding advantage within the game.
Suppose we want the player to ask questions of slightly more complexity - we might want to build in a system that understood "who", "what", "where", and "when", for instance. We could use a topic table for this, too:
"The Queen of Sheba"
Interrogative is a kind of value. The interrogatives are who, what, when, where, how, and why.
Current question is an interrogative that varies.
After asking someone about something: respond to the question. After answering someone that something: respond to the question.
After telling someone about something: say "You're here to ask questions and test Solomon's wisdom, not to give him a sample of your own."
Table of Wise Answers
topic
|
question type
|
reply
|
"rain/weather/clouds/cloud/rains"
|
what
|
"'Clouds are a disturbance made by the paths of birds,' Solomon replies. 'The air beaten by their wings becomes agitated, as when a river is stirred and the mud churns up.'"
|
"rain/weather/clouds/cloud/rains"
|
where
|
"'Weather is contained in a great silk bag which holds in the heavens,' replies Solomon."
|
"hunger/food/eating"
|
when
|
"'Sorry, are you getting hungry?' he says, and rings a bell to summon servants."
|
"hunger/food/eating"
|
why
|
"'Men were made to need food in order that they must farm and cook and dine together,' Solomon replies. 'Otherwise, they might live apart, each sufficient in himself. But no man can feed himself alone all through his life.'"
|
"Solomon/he/himself"
|
who
|
"'As you see,' he says, holding out his arms to each side."
|
"Solomon/he/himself"
|
what
|
"'I am an ordinary man,' he answers."
|
One of the nice things about this system is that it only resets the "current question" when we get a new question word. For instance, this test will produce different replies to the question about Solomon himself, because the second time he is still in the mode of answering "what" questions:
Test me with "ask solomon about himself / ask solomon what rain is / ask solomon about himself".
If Solomon is to live up to his reputation at all, his wisdom table will have to be quite a bit longer - though one also would want to be careful, because forcing the game to cycle through a really immense table could be quite time-consuming. In fact, for the sake of this example, let's reward the player for managing to stay within the (narrow) range of Solomon's knowledge:
The Hall of Almug Tree Pillars is a room. "The pillars of the room are made of almug tree, the ceiling made of silk and the floor of glass." Solomon is a man in the Hall of Almug Tree Pillars. Solomon has a number called wisdom. The wisdom of Solomon is 0.
Every turn:
if the wisdom of Solomon is 3:
say "Truly, Solomon has answered all your questions, and his wisdom is even as great as you had heard!";
end the story saying "Your heart beats strangely fast".
When play begins, say "'Oh, you've arrived,' says Solomon."
In a real game we'd need to be a great deal subtler. All the same, if we have a character of quite limited resources to present to the player, it's a good idea to give the player some incentive to stay on topic, ask questions the character can answer, and generally interact within the parameters we're prepared for.
Now, this last bit requires some trickery from later chapters, particularly those on Understanding and Activities, to pull the question words out of the player's command:
After reading a command:
if the player's command includes "[interrogative]", now the current question is the interrogative understood.
To respond to the question:
repeat through the Table of Wise Answers:
if the topic understood includes topic entry:
if the current question is the question type entry:
say "[reply entry][paragraph break]";
increment the wisdom of Solomon;
rule succeeds;
say "Solomon looks blank, appalled by a question for which he was not prepared.";
end the story saying "You have befuddled Solomon!"
Understand "ask [someone] [text]" as asking it about.
And now we have a game that will accept (though not always respond very sensibly to) questions of almost any form we might put to another character: ASK SOLOMON WHAT RAIN IS will be answered, but then again, it won't be distinguished from, say, ASK SOLOMON WHETHER THIS PERSISTENT RAIN IS A DIVINE PUNISHMENT OR WHAT.
All the same, a system that allowed the player a bit more specification of questions than simple keyword-use might be useful in a mystery game, for instance, where we might want to let our detective conduct inquiries into specific details. An alternative approach to the rather free one above would be to force the player to use only questions of the form WHAT IS RAIN? or WHO ARE YOU?: this would cut down on false-positive matches. But we might still choose to store the responses in a table of this type.