ยง16.19. Table amendments
Tables can have amendments as well as continuations. The arrangement is much the same: a supplementary table supplies new rows for the original table. But instead of adding the new rows at the end of the original, as a continuation would, an amendment replaces matching rows in the original. (So the original stays the same size.)
The amendment table must have exactly the columns of the original and in the same order. Moreover, each row in the amended table must match exactly one row in the original. For instance:
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" |
creates a three-row Table of Plans, with reference to the chocolate bars struck out.
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.
For the present, at least, the columns used for matching may only contain: numbers, times, objects, action names, activities, figure names, sound names, truth states and any new kinds of value or units which have been declared.
|  ExampleTrieste Table amendment to adjust HELP commands provided for the player.
|
|
Suppose we are using an extension in which another author has defined some help topics for the player, and we want to amend them for our game.
We'll start with the portion of the text that we have inherited from the extension:
"Trieste"
Section 1 - Procedure
A help-topic is a kind of value. Some help-topics are defined by the Table of Standard Instructions.
Table of Standard Instructions
help-topic | reply |
commands | "This game recognizes 150 common commands for forms of military attack. These include..." |
saving | "To save the game, type SAVE. You will be prompted to supply a file-name for your saved game. If you'd like to return to play at that point again later, RESTORE the saved game." |
Understand "help [help-topic]" as asking for help about. Asking for help about is an action out of world, applying to one help-topic.
Understand "help" or "help [text]" as a mistake ("Help is available on the following topics: [help-topics list]").
To say help-topics list:
repeat through the Table of Standard Instructions:
say "[line break] [help-topic entry]";
Carry out asking for help about:
repeat through the Table of Standard Instructions:
if the help-topic understood is the help-topic entry:
say "[reply entry][paragraph break]";
break.
Section 2 - Scenario
Now, let's imagine our game is a special one in which only a very limited supply of moves are allowed. In that case, we'll want to replace the information on commands:
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." |
Board Room is a room. Mark is a man in the Board Room. "Russia (played by Mark) is also hovering over the board."
Guest Bathroom is south of Board Room. Lena and Rob are in the Guest Bathroom. Lena is a woman. Rob is a man.
Rule for writing a paragraph about Lena when Lena is in the Guest Bathroom and Rob is in the Guest Bathroom:
say "[Lena] (Italy) and [Rob] (Great Britain) are having a hushed conversation while leaning against your good towels. They stop and stare at you when you come in."
Test me with "help / help commands / help saving".