Chapter 15: Tables
15.13. Topic columns

When double-quoted matter appears in a column of a table, Inform will normally treat that as text for printing out. The exception is when the column is called "topic", where it is treated as text for comparing against what the player has typed. There is really only one operation allowed with topic columns, the "...listed in..." construction, but fortunately it is the one most often needed.

Let us suppose that the Sybil has a penchant for telling passers-by which is the Greek muse for what. We might write:

After asking the Sybil about a topic listed in the Table of Sybil's Replies, say "The Sybil declaims for a while, the gist being that the muse in question looks after [muse entry]."

We can then provide a simple table giving her responses:

Table of Sybil's Replies
Topic   Muse   
"calliope"   "epic poetry"   
"clio"   "history"   
"erato"   "love poetry"   
"euterpe"   "music"   
"melpomene"   "tragedy"   
"polyhymnia"   "sacred poetry"   
"terpsichore"   "dancing"   
"thalia"   "comedy"   
"urania"   "astronomy"   
"monica"   "tidiness"   
"phoebe"   "massage"   
"rachel"   "oval hair-cuts"   

Topics can use the full range of abilities of the "understanding" system which Inform uses to parse text, and which will be the subject of a later chapter. For now, note that the Sybil's topics might equally include "flora/eve" (matching the single word "flora" or the single word "eve"), or something more elaborate such as:

"Bridget" or "Bridge" or "Bridget Jones"

* See Understand for the system Inform uses to parse text


266
* Example  Merlin
A REMEMBER command which accepts any text and looks up a response in a table of recollections.

RB

"Merlin"

Understand "remember [text]" as remembering.

Remembering is an action applying to one topic.

Carry out remembering:
    say "Nothing comes to mind.".

Instead of remembering a topic listed in the Table of Recollections:
    say "[response entry][paragraph break]".

Table of Recollections
Topic   Response   
"rain/weather"   "You've seen worse, but not often: it's falling so hard now that the tin rattles and the runoff, on the low side of the roof, would be a tenable source of hydroelectric power."   
"hydroelectric power" or "power/hydroelectric"   "It's not as though you have any sort of light bulb in here to turn on, even if you could power it."   
"light bulb" or "light/bulb"   "Light bulbs, like so much else, are a thing of your past. Or is it your future? Tricky, the way the world loops round on itself."   
"past/time/future"   "Living backwards has its drawbacks. A tendency to confuse and annoy your friends, being one; the total inability to maintain a stable relationship; and a deep dissatisfaction with most of the bodily processes people enjoy, since they ultimately make you hungrier, colder, or-- no point dwelling on it, really."   
"backwards"   "It's not even exactly *backwards*, now is it? It's more like a series of forwardses stuck back to back. As though someone had taken each track of a CD and put them in the exactly wrong order. You miss that. The music on demand."   

The Inadequate Shelter is a room. "A piece of corrugated tin, leaned on two sticks, and pathetically augmented with a tire (on one side) and a cardboard box (on the side towards the wind). And that's what you've got between you and the driving rain.

At the moment rain is all you can remember, in fact."

Test me with "remember rain / remember power / remember light bulb / remember future / remember backwards".

267
*** Example  The Queen of Sheba
Allowing the player to use question words, and using that information to modify the response given by the other character.

RB
268
*** Example  Questionable Revolutions
An expansion on the previous idea, only this time we store information and let characters answer depending on their expertise in a given area.

RB


PreviousContentsNext