Inform 7 Home Page / Documentation
§16.10. Adding and removing rows
Writing in new rows is simple, once we can find space for them:
choose a/the/-- blank row in/from (table name)
This phrase chooses a row in the given table which is currently blank under every column. A run-time problem message is issued if no rows are blank. Example:
To avoid problem messages, it can be important to worry about free space. To that end we can not only find the number of rows (as we have already seen) but also the number currently blank and not blank:
number of blank rows in/from (table name) ... number
This phrase produces the number of rows in the given table which are entirely blank (that is, blank under every column).
number of filled rows in/from (table name) ... number
This phrase produces the number of rows in the given table which are not entirely blank (that is, at least one column has a value in this row).
"Filled" here really means "non-blank": a row can be filled in this sense even if only one of its values exists. Since every row is either blank or filled, it must be true that:
the number of blank rows in Table 3
the number of filled rows in Table 3
add up to "the number of rows in Table 3".
We've seen that blank entries can be filled with values using "now":
now symbol entry is "F";
But the same method can't be used to put blanks back, since a blank is not a value. Instead:
blank out (a table entry)
This phrase replaces the entry referred to with a blank, erasing any value previously stored there. Example:
These more destructive phrases need a steady hand:
blank out the whole row
This phrase replaces the currently chosen row with blanks, erasing any value previously stored under any of the columns. Example:
blank out the whole (table column) column in (table)
This phrase replaces the currently chosen column with blanks, erasing any value previously stored in any of the rows. Example:
blank out the whole of (table)
This phrase replaces every row of the currently chosen table with blanks, erasing any value previously stored anywhere in it. Example:
This is only really useful when a Table is being used to hold working space for some calculation or other.
Corinth is a room. Athens is east of Corinth. Epidaurus is southeast of Corinth and east of Mycenae. Mycenae is south of Corinth. Olympia is west of Mycenae. Argos is south of Mycenae. Thebes is northwest of Athens. Pylos is south of Olympia. Sparta is east of Pylos and south of Argos. Delphi is northwest of Thebes.
Athena will proceed, unless delayed, through a list of locations stored in a simple table. Rather than using Inform's route-finding abilities ("the best route from..."), we simply move Athena from one location to the next, not even using the going action: she moves in mysterious ways, as befits a goddess.
Every turn when Athena is active:
repeat through the Table of Athena's Movement:
let last space be the location of Athena;
if Athena can be seen by the player, say "Athena heads to [the destination entry].";
move Athena to destination entry;
if Athena can be seen by the player, say "Athena arrives from [the last space].";
blank out the whole row;
By blanking out the table line by line, we make sure that we never lose our place in the path.
Since we want the player to be able to talk to Athena, we need a way to stall her in her path, as well.
Finally, we do need to wake Athena up again if she has become passive. The following rule will occur after the movement rule just because of code ordering, though we could make matters more explicit if we needed to: