9.6. Reading Matter

| Chapter 9: Props: Food, Clothing, Money, Toys, Books, Electronics |

| 9.6. Reading Matter

Many things can be read, from warning notices to encyclopaedias, and a range of techniques is needed to provide them because the quantity of text, and how it presents itself, can vary so much. With a small amount of very large type, the player should not need any command at all to read the text:

> The road sign is in the Junction. The road sign is fixed in place. "A road sign points north: 'Weston on the Green - 6'."

If the print is smaller, or the object portable, the player will expect to use the EXAMINE command:

> The business card is in the Junction. The description is "'Peter de S√®vres: consultant mnemonicist.'"

But if the object is a leaflet, say, EXAMINE should only describe the cover: READ would be the command a player would expect to use to get at the text itself. Inform normally defines READ to be the same command as EXAMINE, which is good for things like the business card, but counter-productive here. The Trouble with Printing shows how to separate these two commands, allowing any thing to have a property called its "printing" for text produced by READ, which will be different from its "description", the text produced by EXAMINE.

If the object is a lengthy diary, say, nobody would read it from cover to cover in a single IF turn. We might then want to allow the player to turn the pages one by one, with commands like READ PAGE 4 IN DIARY or READ THE NEXT PAGE: see Pages.

If the object is an encyclopaedic reference work, the player would consult named entries: see Costa Rican Ornithology, which allows commands like LOOK UP QUETZAL IN GUIDE.

Still larger sources of text often occur in IF: libraries or bookshelves, where many books are found together, and it is clumsy to write them as many individual items. One approach is to simulate an entire bookshelf with a single thing: see Bibliophilia. (This is much like looking up topics in a single book, except that each topic is a book in itself.) Another is to provide each book as an individual item, but have them automatically join together into a single portable collection: see AARP-Gnosis.

Signs, leaflets and encyclopaedias, being printed, have a wording which will never change during play. But sometimes the player reads something which acts of its own accord. Text substitutions are usually all that is needed to achieve this:

> The computer display is on the desk. The description is "Giant green digits read: [the time of day]."

This is easy because we know all the variations we want. But what if we want the player to write his own text, for instance, adding to a diary? This is trickier, because it means storing text as the player typed it, and replaying it later. (And suppose the player types reams and reams of text, not just a few words as we might have hoped?) The Fourth Body and The Fifth Body show how to use an external file - a multimedia trick requiring features only available if the project is set to the Glulx story file format - to handle even the most difficult cases.

94
| Example Costa Rican Ornithology A fully-implemented book, answering questions from a table of data, and responding to failed consultation with a custom message such as "You flip through the Guide to Central American Birds, but find no reference to penguins." |
WI

292
| Example Pages A book with pages that can be read by number (as in "read page 3 in...") and which accepts relative page references as well (such as "read the last page of...", "read the next page", and so on). |
WI

> Suppose we have a book that the player must consult page-by-page, and we want to be able to accept all of the following input: > READ BOOK (to choose a random page and read it) > READ PAGE 1 IN BOOK > READ PAGE 2 > READ THE LAST PAGE OF THE BOOK > READ THE NEXT PAGE > READ PREVIOUS PAGE IN BOOK > READ THE FIRST PAGE One approach would be to write many different understand rules and actions: one action for reading randomly, one for reading a specific page, one for reading the first page, one for reading the previous page, one for reading the next page, and one for reading the last page. But this gets tedious to construct and maintain. More usefully, we could consider that all of the last four options are essentially the same action at heart: the player is asking to read a page in the book using a name rather than a number, and we will have to perform a minor calculation to discover what the number should be. Here's an implementation using named values to resolve this problem: "Pages" The Library is a room. The sinister book is carried by the player. The sinister book has a number called the last page read. The sinister book has a number called the length. The length of the sinister book is 50. Understand the command "read" as something new. Understand "read [something]" or "consult [something]" or "read in/from [something]" as reading. Reading is an action applying to one thing, requiring light. Understand "read [number] in/from/of [something]" or "read page [number] in/from/of [something]" or "look up page [number] in/from/of [something]" or "consult page [number] in/from/of [something]" as reading it in. Reading it in is an action applying to one number and one thing, requiring light. Named page is a kind of value. The named pages are first page, last page, next page, previous page. To decide what number is the effective value of (L - last page): decide on the length of the book. To decide what number is the effective value of (F - first page): decide on 1. To decide what number is the effective value of (N - next page): let X be the last page read of the book plus 1; decide on X. To decide what number is the effective value of (P - previous page): let X be the last page read of the book minus 1; decide on X. Understand "read [named page] in/from/of [something]" or "read the [named page] in/from/of [something]" as reading it relatively in. Reading it relatively in is an action applying to one named page and one thing, requiring light. Does the player mean reading something in the sinister book: it is very likely. This is the book requirement rule: if the player is not carrying the sinister book, say "You're not reading anything." instead. Check reading it relatively in: if the second noun is not the sinister book, say "There are no pages in [the second noun]." instead; abide by the book requirement rule. Carry out reading it relatively in: let N be the effective value of the named page understood; now the number understood is N; try reading N in the book. Check reading it in: if the second noun is not the sinister book, say "There are no pages in [the second noun]." instead; abide by the book requirement rule. Check reading it in: if the number understood is greater than the length of the sinister book, say "There are only [length of sinister book in words] pages in the book." instead; if the number understood is less than 1, say "The page numbering begins with 1." instead. Carry out reading it in: read page number understood. Check reading: if the noun is not the sinister book, say "There are no pages in [the noun]." instead; abide by the book requirement rule. Carry out reading: let N be a random number between 1 and the length of the sinister book; now the number understood is N; say "You flip the pages randomly and arrive at page [the number understood]:[paragraph break]"; try reading the number understood in the sinister book. Table of Book Contents
> page | content
> 2 | "dhuma jyotih salila marutam / samnipatah kva meghah / samdes arthah kva patukaranaih / pranibhih prapaniyah"
> 13 | "amathesteron pws eipe kai saphesteron"
> 50 | "Rrgshilz maplot..."
To read page (N - a number): now the last page read of the sinister book is N; if there is a content corresponding to a page of N in the Table of Book Contents: choose row with a page of N in the Table of Book Contents; say "You read: '[content entry]'[paragraph break]"; otherwise: say "Page [N] appears to be blank." To read page (N - 47): say "Your eyes burn; your ears ring. Beneath your gaze, the dreadful sigils writhe, reminding you of that which lies outside the edges of the universe..."; end the story saying "You have lost your remaining sanity". Test me with "read from the sinister book / read the book / read the next page / read page 2 / read previous page / g / read the first page / read the last page of the book / read the next page / read 47 in book".

313
| Example Bibliophilia A bookshelf with a number of books, where the player's command to examine something will be interpreted as an attempt to look up titles if the bookshelf is present, but otherwise given the usual response. |
WI

322
| Example AARP-Gnosis An Encyclopedia set which treats volumes in the same place as a single object, but can also be split up. |
WI

281
| Example The Trouble with Printing Making a READ command, distinct from EXAMINE, for legible objects. |
WI

432
| Example The Fourth Body Notebooks in which the player can record assorted notes throughout play. |
WI

433
| Example The Fifth Body An expansion on the notebook, allowing the player somewhat more room in which to type his recorded remark. |
WI

Previous | Contents | Next