I7: Trying to make a kind of a book from an example

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

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.

if the second noun is not a newspaper, say “There are no pages in [the second noun].” instead;
abide by the newspaper requirement rule.

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.

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.

``` (N - a number; the issue - a newspaper) ```I’m not aware that Inform 7 tolerates this kind of parameter collection. Have you tried doing something like this?

``To read page (N - a number) for (the issue - a newspaper):``

Ok, I’ve “improved” the code, using your direction, now it looks as this:

[spoiler]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 [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, say “You’re not reading anything.” instead.

if the second noun is not a newspaper, say “There are no pages in [the second noun].” instead;
abide by the newspaper requirement rule.

Carry out reading it relatively in (the issue - a newspaper):
let N be the effective value of the named page understood;
now the number understood is N;
try reading N in the issue.

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 (the issue - a newspaper):
if the number understood is greater than the length of the issue, say “There are only [length of issue in words] pages in the book.” instead;
if the number understood is less than 1, say “The page numbering begins with 1.” instead.

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) in (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]

Now it gives me the error:

[code]Problem. In the sentence ‘Carry out reading it relatively in (the issue - a newspaper)’ , I was expecting to read an arithmetic value, but instead found some text that I couldn’t understand - ‘issue’.

I was trying to match this phrase:

(issue - arithmetic value) - (newspaper - arithmetic value)

This was what I found out:

issue = something unrecognised

newspaper = a description of newspapers
[/code]

That is, is trying to decipher that sintax as subtract…

Any idea?

Ok, now it works! Thanks to a friend, we were at late until it worked. Here is the code, a kind for newspapers, hope you enjoy it:

[code]A newspaper is a kind of thing. A newspaper has a number called the actual page. The actual page of a newspaper is usually 1. A newspaper has a number called the length. The length of a newspaper is usually 3. A newspaper has a table name called the contents of the news.

Understand “newspaper”, “paper”, “news”, and “daily” as a newspaper.

Understand the command “read” as something new.

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) for (book - a newspaper):
decide on the length of the book.

To decide what number is the effective value of (F - first page) for (book - a newspaper):
decide on 1.

To decide what number is the effective value of (N - next page) for (book - a newspaper):
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) for (book - a newspaper):
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, say “You’re not reading anything.” instead.

if the second noun is not a newspaper, say “There are no pages in [the second noun].” instead;
abide by the newspaper requirement rule.

Carry out reading it relatively in:
let N be the effective value of the named page understood for second noun;
now the number understood is N;
try reading N in the second noun.

if the second noun is not a newspaper, say “There are no pages in [the second noun].” instead;
if the number understood is greater than the length of the second noun, say “There are only [length of the second noun in words] pages in the book.” instead;
if the number understood is less than 1, say “The page numbering begins with 1.” instead;
abide by the newspaper requirement rule.

read page number understood in the second noun.

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 a newspaper (called the issue):
try reading the actual page of the issue 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) in (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.”[/code]

And one newspaper as an instance:

[code]The newsseptember9 is a newspaper. The printed name of the newsseptember9 is “newspaper, september 9”. The contents of the news of newsseptember9 is the Table of Newspaper September 9 Contents.

Table of Newspaper September 9 Contents
page content
1 “Pending”
2 “Pending”