#Chapter 16, continued
Section 16.15 is Varying which table to look at
This is just make a table name that varies. So check this out:
Table 1 - Nifty Opening Plays in US Scrabble
| word | score |
|---|---|
| “muzjiks” | 128 |
Table 2 - Nifty Opening Plays in UK Scrabble
| word | score |
|---|---|
| “quartzy” | 126 |
| “squeezy” | 126 |
The lexicon is a table name that varies. The lexicon is Table 1.
To flip tables:
say "You exchange dictionaries, lexically crossing the Atlantic. ";
if the lexicon is Table 1, now the lexicon is Table 2;
otherwise now the lexicon is Table 1;
choose a random row in the lexicon;
say "Did you know that according to [the lexicon], [word entry] scores [score entry]?"
Example 281 is Farewell
Table of Tina’s Chatter
| topic | reply | summary | turn stamp |
|---|---|---|---|
| “aasvogel” | “‘Oh, it’s a vulture.’” | “that an aasvogel is a vulture” | a number |
| “acaudate” | “She shrugs, mid-pour. ‘Means something doesn’t have a tail.’” | “that acaudate means ‘tailless’” | – |
| “absorptiometer” | “‘It’s a thing that measures the solubility of gases in a liquid,’ she explains gently, as to a child.” | “that an absorptiometer measures solubility of gasses in a liquid” | – |
Table of George’s Chatter
| topic | reply | summary | turn stamp |
|---|---|---|---|
| “baccaceous” | “‘Something that has or bears berries,’ says George, without looking up.” | “that baccaceous means berry-bearing or berry-like” | a number |
| “bagheera” | “‘Oh, that’d be a velvet-like textile.’” | “that bagheera is a velvet-like textile” | – |
| “balistarius” | “‘That’s a crossbow-man,’ George replies instantly.” | “that a balistarius is a crossbow-man” | – |
A person has a table name called conversation.
Instead of asking someone about something:
let the source be the conversation of the noun;
if topic understood is a topic listed in source:
if there is a turn stamp entry:
say "[The noun] has already told you that [summary entry].";
otherwise:
now turn stamp entry is the turn count;
say "[reply entry][paragraph break]";
otherwise:
say "[The noun] stares at you blankly."
Hmm, this is pretty similar to my own conversation extension, but I didn’t use tables, as a lot of the responses are quite long and often have extra effects.
Section 16.16 is Defining things with tables
This is used when you want to define a large group of similar objects but don’t want to fill out a long and tedious template:
The Staging Area is a room. A jersey is a kind of thing. A jersey is wearable. Some jerseys in the Staging Area are defined by the Table of Honorary Jerseys. The description of a jersey is "Since [year established], the Tour de France has awarded this jersey to the [citation]."
Table of Honorary Jerseys
| jersey | year established | citation |
|---|---|---|
| a yellow jersey | 1919 | “race leader” |
| a polkadot jersey | 1933 | “King of the Mountains” |
| a green jersey | 1953 | “highest point scorer on sprints” |
| a white jersey | 1975 | “best cyclist aged 25 or less” |
The first column provides names for the things, and it automatically creates the properties ‘year established’ and ‘citation’ for each thing.
Given a blank space, that thing is just not input. You can also make kinds this way, like ‘some kinds of jerseys are’).
This would be a convenient way of handling boring scenery items. You could have a column for the internal name, a column for the room it’s in, a column for its description, a column for synonyms, a column for printed name, and a column for interaction message.
Example 282 is Sweeney:
This is a complex example I won’t reproduce here. It has multiple tables, each table corresponding to a conversation topic, and each table having multiple questions and answers.
Example 283 is Introduction to Juggling:
| toy | cost | restriction | description | difficulty | outcome |
|---|---|---|---|---|---|
| an economy bounce ball set | $10.00 | “comes in set of three” | “A fairly ordinary rubber ball, solid color.” | moderate | “You create of the balls a cascade of moving color.” |
| an acrylic contact ball | $14.00 | “should be bought with ball polish” | “A large clear ball, not for throwing but for using in various hand tricks.” | hard | “You rotate the ball between your fingers and pass it over the backs of your hands.” |
| a UV-reactive contact ball | $55.00 | “appears to glow in dark rooms” | “Similar to the ordinary acrylic contact ball, but UV-reactive.” | hard | “The ball glows as it passes between your fingers and over the backs of your hands, rolls up to your wrist, snaps through the air-- all apparently of its own accord.” |
| a ball polish set | $10.00 | “useful only with acrylic contact balls” | “Three bottles of polish and a rag for keeping acrylic contact balls scratch-free.” | hard | “You juggle the polish bottles with difficulty, since they are full of sloshing liquid.” |
| a teaching beanbag set | $8.00 | “set of three” | “Soft, easily-juggled bag.” | easy | “You juggle the beanbags with basic competence.” |
| a stage ball set | $13.50 | “comes in set of three” | “Not much different in appearance from the economy bounce ball, but larger so as to be visible from a stage.” | moderate | “You create of the balls a cascade of moving color, visible from quite a distance.” |
| a fireball set | $33.00 | “will not be sold to minors” | “A ball has wicking and a fuel-source inside so that it will burn while being juggled.” | hard | “You juggle the fireballs rapidly, careful never to hold any of them a moment longer than necessary.” |
Section 16.17 is Defining values with tables
It’s a convenient way for defining values with associated properties:
Solar distance is a kind of value. 1000 AU specifies a solar distance. Planet is a kind of value. The planets are defined by the Table of Outer Planets.
Table of Outer Planets
| planet | semimajor axis |
|---|---|
| Jupiter | 5 AU |
| Saturn | 10 AU |
| Uranus | 19 AU |
| Neptune | 30 AU |
| Pluto | 39 AU |
With these definitions, one can say:
say "Pluto orbits at [semimajor axis of Pluto]."
Columns are created one at a time, so you can use earlier columns in later columns:
Table of Outer Planets
| planet | semimajor axis | centre of government |
|---|---|---|
| Jupiter | 5 AU | Jupiter |
| Saturn | 10 AU | Saturn |
| Uranus | 19 AU | Saturn |
| Neptune | 30 AU | Pluto |
| Pluto | 39 AU | Pluto |
Column names can’t coincide with any other names of properties of other things, so goofier column names are better here.
Two technical footnotes. In a table used to define a kind of value, blank entries are not left blank: they are filled in with suitable default values. For instance, if the semimajor axis column had been all "–"s except for listing Neptune at “30 AU”, say, Inform would deduce that the column was meant to hold a value of kind “solar distance”, and would set the solar distances for all of the other planets to be “0 AU”. It does this to ensure that “solar distance of P” exists for any planet P.
The second technical note is that we must not sort such a table, because it is used during play to store the properties, and if it were to get rearranged then so would the properties be - with probably disastrous results.
Section 16.18 is Table continuations
This is something vital for using many extnsions and even some core Inform stuff (like the table used for questions after beating the game).
You can start making a table:
Table of Outer Planets
| planet | semimajor axis |
|---|---|
| Jupiter | 5 AU |
| Saturn | 10 AU |
| Uranus | 19 AU |
| Neptune | 30 AU |
| Pluto | 39 AU |
and then finish it later:
Table of Outer Planets (continued)
| planet | semimajor axis |
|---|---|
| Orcus | 39 AU |
| Quaoar | 43 AU |
| Xena | 68 AU |
| Sedna | 524 AU |
This is useful for extensions especially.
The continuation must have the same name as the original, because it is the original.
Some fun side notes are included in this section:
At time of writing the International Astronomical Union has not yet consented to name 2003 UB313 after Xena, the Warrior Princess, but this is surely only a bureaucratic delay. (Footnote: on 24 August 2006 it was demoted to dwarf planet status, like the luckless Pluto, and on 13 September renamed Eris; though its moon’s official name, Dysnomia, is an ingenious double-meaning to do with the name of Xena’s actress, Lucy Lawless.)
Example 284 is Food Network Interactive
It shows how to continue a table used in extensions.
Include Basic Screen Effects by Emily Short. Include Menus by Emily Short. Include Basic Help Menu by Emily Short.
Table of Basic Help Options (continued)
|title|subtable|description|toggle|
| — | — | — | — |
|“Recipes in This Game”|Table of Recipes|–|–|
|“Contacting the Author”|–|“If you have any difficulties with [story title], please contact me at fakeaddress@gmail.com.”|
And then another table later for a sub-menu (this is not a continuation, just a feature of the extension that turns tables into submenus:
Table of Recipes
| title | subtable | description | toggle |
|---|---|---|---|
| “Salmon Tartare” | – | “First, be sure to buy extremely fresh salmon. Raw fish should be served on the day it was caught, if possible. To guarantee this, visit an Asian supermarket or specialty store, and buy salmon marked ‘sashimi grade’…” | – |
| “Pecan Brownies” | – | “Begin by shelling half a pound of pecans…” | – |
Whole Foods is a room.
Finally, section 16.19 is Table amendments
It just replaces rows in a table.
Table of Plans
| moment | outcome |
|---|---|
| 10 AM | “takeover of Mars” |
| 11:30 AM | “canals reflooded” |
| 11:45 AM | “chocolate bar production doubled” |
Table of Plans (amended)
| moment | outcome |
|---|---|
| 11:45 AM | “volcanic cave production doubled” |
Amendment rows may be given in any order. The process of matching a row begins at the left-most column: Inform tries to see if any single row in the original table has a matching entry. If none does, a Problem is issued. If more than one do, Inform then looks at the second column, and so on. For instance:
Enthusiasm is a kind of value. The enthusiasms are pumped, wired and languid.
Table of Mental States
| feeling | extent | consequence |
|---|---|---|
| pumped | 1 | “you feel able to run for your life” |
| pumped | 2 | “you feel able to run for President” |
| wired | 1 | “you feel able to run” |
| languid | 1 | “you feel” |
Table of Mental States (amended)
| feeling | extent | consequence |
|---|---|---|
| pumped | 2 | “you feel able to run for the Nebraska State Legislature” |
Here the amendment is made to the second row of the original table. The value in the leftmost column, “pumped”, matches two rows in the original, so Inform moves on to the next column, reads “2”, and finds that only one row in the original still qualifies - so that is the one replaced.
Example 285 is Trieste:
This just modifies an extension’s help menu:
Table of Standard Instructions (amended)
| help-topic | reply |
|---|---|
| commands | “The only commands this game recognizes are HOLD, MOVE, CONVOY, SUPPORT MOVE, and SUPPORT HOLD. No others are necessary.” |
I don’t have many comments here; tables seem like straightforward implementations of relational databases (is that the phrase?) and I don’t really use them much. To me this is like browsing a hardware store and getting to the fastener aisle. Essential, useful, but dull.
Any table fans reading along that want to speak up in favor of tables?