Inform 7 Home Page / Documentation


§16.4. Changing entries

Here is another rather definitive, immutable-looking table:

paste.png Table 4 - Recent Monarchs

Name

Accession

Family

"Anne"

1702

Stuart

"George I"

1714

Hanover

"George II"

1720

Hanover

"George III"

1760

Hanover

"George IV"

1820

Hanover

"William IV"

1830

Hanover

"Victoria"

1837

Hanover

"Edward VII"

1901

Saxe-Coburg-Gotha

"George V"

1910

Windsor

"Edward VIII"

1936

Windsor

"George VI"

1936

Windsor

"Elizabeth II"

1952

Windsor

But table entries can be changed as freely as variables: that is, any value can be entered so long as it has the right kind. We cannot put a dynasty into the "Name" column, or text in the "Accession" column. The phrase needed is "now ... is ...", just as it is for properties or variables:

Dynasty is a kind of value. The dynasties are Stuart, Hanover, Saxe-Coburg-Gotha and Windsor.

The Table Office is a room. The Succession is in the Table Office. "The Succession, a ponderous list of English monarchs, takes pride of place."

Instead of examining the Succession:
    say "The Succession List runs as follows...";
    repeat with N running from 1 to the number of rows in the Table of Recent Monarchs:
        say "[accession in row N of Table 4]: [name in row N of Table 4] ([family in row N of Table 4])."

Instead of attacking the Succession:
    now the family corresponding to an accession of 1720 in the Table of Recent Monarchs is Stuart;
    now the name in row 4 of the Table of Recent Monarchs is "Graham I";
    now the name in row 5 of the Table of Recent Monarchs is "Trixibelle IV";
    say "You deface the English succession, making suitable amendments with a quill pen. Considering it is supposed to be mightier than the sword the effect is a little disappointing."

Test me with "examine succession / attack it / examine it".

Once we start changing tables, it sometimes becomes useful to check what they contain.

showme the contents of (table name)

This phrase prints a crude but sometimes useful display on screen of the current contents of the named table. It's intended for authors to see when testing, not for players of the finished version to see.

say "[current table row]"

This text substitution produces a crude but sometimes useful listing of the entries in the currently chosen table row.

say "[row (number) in/from table (table name)]"

This text substitution produces a crude but sometimes useful listing of the entries in the specified row.

say "[(column name) in/from table (table name)]"

This text substitution produces a crude but sometimes useful listing of the entries in the specified column.


arrow-up.png Start of Chapter 16: Tables
arrow-left.png Back to §16.3. Corresponding entries
arrow-right.png Onward to §16.5. Choosing rows