16.6. Actions applying to kinds of value

| Chapter 16: Understanding |

| 16.6. Actions applying to kinds of value

Almost all actions apply to things: the player picks them up, pushes them, looks at them and so on. We only occasionally need to recognise other kinds of value, but when we do, we can. For instance:

> Adjusting it to is an action applying to one thing and one number.

> Understand "adjust [something] to [a number]" as adjusting it to.

The substitution "[a number]" matches any number (actually any whole number that is not too large) typed by the player. Inform checks the various kinds being used to make sure that everything matches, so, for instance, this would be disallowed:

> Understand "adjust [something] to [something]" as adjusting it to.

287
| Example Safety A safe whose dial can be turned with SPIN SAFE TO 1131, and which will open only with the correct combination. |
RB

288
| Example Tom's Midnight Garden A clock kind that can be set to any time using "the time understood"; may be turned on and off; and will advance itself only when running. Time on the face is also reported differently depending on whether the clock is analog or digital. |
RB

289
| Example Ibid. A system which allows the author to assign footnotes to descriptions, and permits the player to retrieve them again by number, using "the number understood". Footnotes will automatically number themselves, according to the order in which the player discovers them. |
RB

> "Hitchhiker's Guide to the Galaxy" introduced the idea of footnoted descriptions, and various IF games since have toyed with the idea. The recommended implementation in Inform 6 involved keeping an assortment of footnote objects around, but in Inform 7 the table is a much tidier way of handling the same problem. "Ibid." The Ship Inn is a room. "Here you are in a lovely pub which your guidebook assures you is extremely authentic. [1 as a footnote]. To your left sits a party of Italians, with their guidebook. To your right is a silent, but not unappealing, young man.". A party of Italians and a silent young man are people in the Ship Inn. The Italians and the young man are scenery. The table is a supporter in the Ship Inn. On the table is a mysterious pie. The description of the pie is "Your waitress told you it was the specialty of the day, Steak and Owl Pie. [2 as a footnote]." The pie is edible. Table of Footnotes
> assignment | note
> a number | "Francis Drake ate here, if the sign on the door is to be believed"
> -- | "this is unlikely, considering that owls are protected animals in England these days [3 as a footnote]"
> -- | "moreover, you can't imagine that owl would be very tasty"
Footnotes mentioned is a number that varies. Whenever we mention a footnote for the first time, we need to assign it a number, which we will use consistently thereafter. And it's probably a good idea to protect ourselves against the author accidentally using a number too large for the footnote table, too. So: To say (footnote - a number) as a footnote: if footnote > number of filled rows in the Table of Footnotes: say "Programming error: footnote assignment out of range."; otherwise: choose row footnote in the Table of Footnotes; if there is an assignment entry: say "([assignment entry])"; otherwise: increment footnotes mentioned; choose row footnote in the Table of Footnotes; now assignment entry is footnotes mentioned; say "([assignment entry])". Now, in order to let the player view these footnotes, we'll need to parse numbers. Understand "footnote [number]" as looking up a footnote. Looking up a footnote is an action applying to one number. Check looking up a footnote: if the number understood > footnotes mentioned, say "You haven't seen any such footnote." instead; if the number understood < 1, say "Footnotes are numbered from 1." Carry out looking up a footnote: choose row with assignment of number understood in the Table of Footnotes; say "([assignment entry]): [note entry]." Test me with "footnote 1 / examine pie / footnote 2 / footnote 3". This method does require us to keep track of where a footnote appears in the table. If we found this inconvenient, we could add a column to the footnote table so that we could invoke it with tags like "[appearance quip as a footnote]".

Previous | Contents | Next