Section - Books
Understand the command "read" as something new. Reading is an action applying to one visible thing. Understand "read [something]" as reading.
Check reading when night and location is not regionally in Dreamlands: say "It's too dark to read right now." instead.
Check reading: if noun is not a book, try examining noun instead.
A book is a kind of thing. Understand "book" or "books" or "page" or "pages" as a book.
A book can be open or closed. A book can be openable. A book is usually closed. A book is always openable. Does the player mean doing something to an open book: it is likely. Check opening a book (called tome): try reading tome instead. Check closing a book (called tome): now tome is closed; say "You close [the tome] again." instead.
A book has a number called current page. The current page of a book is usually 0. To say current page of (tome - a book): let n be the current page of tome; choose row n in the contents of tome; say "[desc entry]".
A book has a table-name called contents. The contents of a book is usually Table of No Contents.
Table of No Contents
|"The page is blank."|
Carry out reading:
repeat with tome running through books enclosed by location:
now tome is closed;
now noun is open;
if current page of noun is 0, now current page of noun is 1;
say "[if current page of noun is 1]You open [the noun] and study the first page.[paragraph break][end if][current page of noun][paragraph break][if the current page of noun is at most the number of rows in contents of noun - 1]It looks like you could see more if you turn the page[otherwise][The noun] is turned to the last page[end if].".
Check turning a book (called tome):
increase the current page of tome by 1;
if current page of tome is greater than the number of rows in contents of tome begin;
now the current page of tome is 0;
say "You seem to have reached the end of [the tome]. You close it again." instead;
say "You turn the page.";
try reading tome instead;