Hi All (here the now defunct Urbatain):
I’m trying to make a kind of newspaper, so I could have several readable books in my game. I’m using the official example 295 “pages” from the chapter of the recipe book, 9.6 “Reading matter”.
This is the modification I’ve made to the example to convert a single book, in a kind, so I could have several newspapers along the story (of course is not working):
[spoiler][code]A newspaper is a kind of thing. A newspaper has a number called the actual page. A newspaper has a number called the length. The length of a newspaper is usually 5. A newspaper has a table name called the contents of the news.
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 actual page of the book plus 1;
decide on X.
To decide what number is the effective value of (P - previous page):
let X be the actual page 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 a newspaper: it is very likely.
This is the newspaper requirement rule:
if the player is not carrying a newspaper book, say “You’re not reading anything.” instead.
Check reading it relatively in:
if the second noun is not a newspaper, 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 a newspaper.
Check reading it in:
if the second noun is not a newspaper, say “There are no pages in [the second noun].” instead;
abide by the newspaper requirement rule.
Check reading it in:
if the number understood is greater than the length of the newspaper, 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 a newspaper, say “There are no pages in [the noun].” instead;
abide by the newspaper requirement rule.
Carry out reading (the issue - a newspaper):
try reading the actual number in the issue.
[ 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.]
To read page (N - a number; the issue - a newspaper):
now the actual page of the issue is N;
if there is a content corresponding to a page of N in the contents of the news of the issue:
choose row with a page of N in the contents of the news of the issue;
say “You read: ‘[content entry]’[paragraph break]”;
otherwise:
say “Page [N] has nothing of interest.”[/spoiler][/code]
The error is this:
Problem. You wrote 'To read page (N - a number' : but I can't find a verb here that I know how to deal with, so I am ignoring this sentence altogether.
Of course, this is not working at all because the example in the recipe book was designed only for ONE book, not a kind of them, so it seems to me that I need to expand that grammar so it has a second noun for the “book”/“newspaper”. However, that would ruin the designed grammar for simplicity. That extended grammar would not allow something quick like “read page one” having the newspaper in the inventory.
So… any idea of how to do this properly? I’m a bit lost.
Thanks a lot.
Ruber.