| 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. Only occasionally do we need to recognise other kinds of value: but when we do, we can, as in the example called "Safety":

> "Safety"

> The Vault is a room. "Snug yet paranoid, this represents the state of the art in cheerless security." The Safe is here. "A mammoth safe, with a dial which can spin to any number, has pride of place. It must weigh about the same as a small car, so don't get any ideas." In the Safe is a silver florin. The Safe is closed and fixed in place. Understand "dial" as the Safe.

> Spinning it to is an action applying to one thing and one number. Check spinning it to: if the noun is not the Safe then say "[The noun] does not spin." instead. Report spinning it to: say "Click! and nothing else happens."

> Understand "spin [something] to [a number]" as spinning it to.

> After spinning the closed Safe to 1384: change the Safe to open; say "Clonk! and the safe door swings slowly open, revealing [list of things in the Safe]."

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 "spin [something] to [something]" as spinning it to.

231
| 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.

232
| 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.

> "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 begin; say "Programming error: footnote assignment out of range."; otherwise; choose row footnote in the Table of Footnotes; if there is an assignment entry begin; say "([assignment entry])"; otherwise; change footnotes mentioned to footnotes mentioned + 1; choose row footnote in the Table of Footnotes; change assignment entry to footnotes mentioned; say "([assignment entry])"; end if; end if. 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