Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Inform 7 Issue

29 views
Skip to first unread message

Jack Jones

unread,
Dec 17, 2010, 1:43:07 AM12/17/10
to
Hello all.
I read that this is the place to come to for help with Inform 7, so I
thought I'd post my problem here. I've made repeated attempts at
learning this program, and I think I'm starting to get the hang of
it. However, I've hit a wall with my current project. I'm trying to
make a game that simulates being a food critic. However, I've hit a
snag in trying to create one of my actions. Below is an abridged
version of the game, which includes all the relevant text that applies
to my problem:

"The Dining Hall is a room. The buffet is in the Dining Hall. "This
buffet looks fantastic, piled impossibly high with french fries,
chicken wings, onion rings, broccoli, pizza, and chicken strips."

Food is a kind of thing. Some french fries are an edible thing.
Some chicken wings are an edible thing. Some onion rings are an
edible thing. The broccoli is an edible thing. The indefinite
article of the broccoli is "some". The pizza is an edible thing. The
indefinite article of the pizza is "some". Some chicken strips are an
edible thing. The french fries are food. The chicken wings are
food. The onion rings are food. The broccoli is food. The pizza is
food. The chicken strips are food. The french fries are on the
buffet. The chicken wings are on the buffet. The onion rings are on
the buffet. The broccoli is on the buffet. The pizza is on the
buffet. The chicken strips are on the buffet.

The french fries are undescribed. The onion rings are undescribed.
The chicken wings are undescribed. The broccoli is undescribed. The
pizza is undescribed. The chicken strips are undescribed.

Table 1.1 - Food Descriptions
food taste to be it or them
french fries "crispy and salty" "are" "them"
chicken wings "hot and spicy" "are" "them"
onion rings "good and crunchy" "are" "them"
broccoli "freshly steamed" "is" "it"
pizza "very cheesy" "is" "it"
chicken strips "crispy" "are" "it"

Table 1.2 - Food Scores
print food quality review servings eaten
0 french fries number snippet 0
0 chicken wings -- -- 0
0 onion rings -- -- 0
0 broccoli -- -- 0
0 pizza -- -- 0
0 chicken strips -- -- 0

Reviewing is an action applying to one thing and one snippet.
Understand "review [one thing] as [one snippet]" as reviewing.

A check reviewing rule:
if the noun is not food:
say "Your abilities as a food critic do not quite extend to [the
noun].";
stop the action;
if the noun is food:
continue the action.

A carry out reviewing rule:
repeat through Table 1.2:
if the noun is a food entry:
change the review entry to the topic understood."

What the reviewing action is supposed to do, in case it's not obvious,
is allow the player to record an opinion of the food they have
sampled. It all supposedly compiles correctly, and then I get this
message:

"Translating the Source - Failed
The application ran your source text through the Inform 7 compiler, as
usual, and it found no problems translating the source. Something must
have gone wrong all the same, because the second stage of the process
- using the Inform 6 compiler to turn this translated source into a
viable story file - turned up errors. This should not happen. The
errors are written out on the Progress tab, but will only make sense
to experienced Inform 6 users (if even to them).

The best option now is probably to reword whatever was last changed
and to try again. Subsequent attempts will not be affected by the
failure of this one, so there is nothing to be gained by restarting
the application or the computer. A failed run should never damage the
source text, so your work cannot be lost.

If you are using Inform 6 inclusions, these are the most likely
culprits. You might be using these without realising it if you are
including an extension which contains Inform 6 inclusions in order to
work its magic: so if the problem only seems to occur when a
particular extension is in use, then that is probably what is at
fault, and you should contact the extension's author directly.

If not, then most likely the Inform 7 compiler is at fault. Please
check that you have the currently distributed build of the system: if
you have, please consider taking the time to fill out a bug report at
the Inform bug tracker (www.inform7.com/bugs).


Sorry for the inconvenience."

This problem occurs whether this text is in the larger game I'm
working on or isolated here. If this isn't just an Inform 7 bug, and
is something I can fix, I would appreciate a solution. Note, I have
Inform 7 v. 6F95, the most up to date.

Sorry for the long post, but I really want to get this problem
licked. Thanks for any help you can give me.

John G. Wood

unread,
Dec 17, 2010, 5:01:45 AM12/17/10
to
There are two things at work here; the first is a problem with Inform,
and I think the second is an error in your code.

You can simplify your example still further to generate the Inform
error:

[code]


The Dining Hall is a room.

Reviewing is an action applying to one thing and one snippet.


Understand "review [one thing] as [one snippet]" as reviewing.

[/code]

This is not right, but Inform should still give a proper error rather
than failing as it does. However, I guess your main concern is getting
your game working, so read on.

I don't think you can use snippets like this. I'm not sure of exactly
what's allowed, but this works:

[code]
Reviewing is an action applying to one thing and one topic.
Understand "review [any thing] as [text]" as reviewing.
[/code]
The use of [any thing] means you can review items that aren't present,
which is probably a good thing.

I'd like to make some more suggestions, but this should get you going
again.

John

Jack Jones

unread,
Dec 17, 2010, 5:56:52 AM12/17/10
to

Hi, John!

Thanks for the suggestion. I implemented it and it works pretty well
until I try to revisit my entries in the table. If you're interested
in giving me your suggestions, here's the full code of what I'm
working with so far. Note: I will be extending the menu to make the
program a little more entertaining, but beyond this point the
fundamental rules will probably not be altered. So again, this is the
full code, everything I've got so far:

[code]


The Dining Hall is a room. The buffet is in the Dining Hall. "This
buffet looks fantastic, piled impossibly high with french fries,
chicken wings, onion rings, broccoli, pizza, and chicken strips."

Food is a kind of thing. Some french fries are an edible thing.
Some chicken wings are an edible thing. Some onion rings are an
edible thing. The broccoli is an edible thing. The indefinite
article of the broccoli is "some". The pizza is an edible thing. The
indefinite article of the pizza is "some". Some chicken strips are an
edible thing. The french fries are food. The chicken wings are
food. The onion rings are food. The broccoli is food. The pizza is
food. The chicken strips are food. The french fries are on the
buffet. The chicken wings are on the buffet. The onion rings are on
the buffet. The broccoli is on the buffet. The pizza is on the
buffet. The chicken strips are on the buffet.

The french fries are undescribed. The onion rings are undescribed.
The chicken wings are undescribed. The broccoli is undescribed. The
pizza is undescribed. The chicken strips are undescribed.

A check taking rule:
if the noun is a food:
if the player has the noun:
say "Why don't you try eating the [noun] that you already have?";
stop the action.

Table 1.1 - Food Descriptions
food taste to be it or them
french fries "crispy and salty" "are" "them"
chicken wings "hot and spicy" "are" "them"
onion rings "good and crunchy" "are" "them"
broccoli "freshly steamed" "is" "it"
pizza "very cheesy" "is" "it"
chicken strips "crispy" "are" "it"

Table 1.2 - Food Scores
print food quality review servings eaten

0 french fries 5 snippet 0


0 chicken wings -- -- 0
0 onion rings -- -- 0
0 broccoli -- -- 0
0 pizza -- -- 0
0 chicken strips -- -- 0

Instead of eating:
if the noun is not edible:
say "That's not something you can eat.";
if the noun is edible:
Repeat through Table 1.1:


if the noun is a food entry:

say "[The noun] [to be entry] [taste entry].";


Rating is an action applying to one thing and one number. Understand
"rate [something] as [number]" as rating.

A check rating rule:


if the noun is not food:
say "Your abilities as a food critic do not quite extend to [the
noun].";
stop the action;
if the noun is food:
continue the action.

A carry out rating rule:


repeat through Table 1.2:
if the noun is a food entry:

change the quality entry to the number understood;
change the print entry to 1.

A report rating rule:
say "You rated the [noun] as [the number understood]. [If the number
understood is less than 5]A failing grade. That's too bad.[Otherwise
if the number understood is at least 8]An excellent grade. I'm sure
the restaurant's management will be happy with the review.[Otherwise]A
middling grade. They're not doing terribly, but not very well
either."

Reviewing as is an action applying to one thing and one topic.
Understand "review [one thing] as [text]" as reviewing as.

A check reviewing as rule:


if the noun is not food:
say "Your abilities as a food critic do not quite extend to [the
noun].";
stop the action;
if the noun is food:
continue the action.

A carry out reviewing as rule:


repeat through Table 1.2:
if the noun is a food entry:

change the review entry to the topic understood;
change the print entry to 1;

After eating:


repeat through Table 1.2:
if the noun is a food entry:

increase the servings eaten entry by 1.

A report reviewing as rule:
say "You reviewed the [noun] as '[the topic understood].'"

The notepad is a thing. The notepad is carried by the player.

Instead of examining the notepad:
say "Here are your notes on the meal so far:";
Repeat with N running from 1 to the number of rows in Table 1.2:
choose row N in Table 1.2;
If the print entry is 1:
say "So far you have eaten [servings eaten entry] of the [food
entry].[If there is a quality entry] You have rated this dish as
[quality entry].[End if][If there is a review entry] You have
reviewed this dish as '[review entry].'[End if]"
[/code]

The problem that this code is giving me is that now when I examine the
notepad, I get an error that says snippets are temporary storage
rather than long term. However, I don't know of any way to actually
capture the text typed by the player, which is what I originally
wanted and tried to do. Again, thanks for the help, and I'd really
appreciate anything you have to say about what I've got now.

John G. Wood

unread,
Dec 17, 2010, 6:02:07 AM12/17/10
to
Hi Jack,

> I read that this is the place to come to for help with Inform 7, so I
> thought I'd post my problem here. I've made repeated attempts at
> learning this program, and I think I'm starting to get the hang of
> it.

You're doing fine, and hopefully my previous post will help with the
practical problem; I just wanted to add a few constructive suggestions.

> "The Dining Hall is a room. The buffet is in the Dining Hall. "This
> buffet looks fantastic, piled impossibly high with french fries,
> chicken wings, onion rings, broccoli, pizza, and chicken strips."

Here, it's not clear whether the description is meant to apply to the
room (it does) or to the buffet. Either way, I would separate out the
code for the buffet and put it in a separate paragraph for clarity.

> Food is a kind of thing.

Good as far as it goes, but you can put more information about food here
to save typing later. I'm thinking particularly of:

Food is usually edible.

> Some french fries are an edible thing. The french fries are food.
> The french fries are on the buffet. The french fries are undescribed.

You don't need to say that the french fries are a thing if you are going
to say they're food. In fact, you can combine all this:

Some french fries are undescribed food on the buffet.

> Table 1.1 - Food Descriptions
> food taste to be it or them
> french fries "crispy and salty" "are" "them"

You shouldn't need the last two columns; just do

Include Plurality by Emily Short.

and then you can use say phrases like is-are. For instance,

Instead of tasting food:
if the noun is a food listed in Table 1.1:
say "[The noun] [is-are] [taste entry].";
otherwise:
say "Very bland."

> A carry out reviewing rule:
> repeat through Table 1.2:
> if the noun is a food entry:
> change the review entry to the topic understood."

You can simplify this in the same way as my taste example, above:

A carry out reviewing rule:

if the noun is a food listed in Table 1.2:
change the review entry to the topic understood;
say "Noted."

I've just added "Noted" so that the player knows it has succeeded; you
can do this here or elsewhere, but it should be somewhere.

Hopefully that's helpful - if not ignore it. ;-)

Good luck with the game!

John

John G. Wood

unread,
Dec 17, 2010, 6:29:52 AM12/17/10
to
Hi Jack,

> The problem that this code is giving me is that now when I examine the
> notepad, I get an error that says snippets are temporary storage
> rather than long term. However, I don't know of any way to actually
> capture the text typed by the player, which is what I originally
> wanted and tried to do. Again, thanks for the help, and I'd really
> appreciate anything you have to say about what I've got now.

You can do it, and it's a simple change I didn't spot before - you need
to use indexed text in the table. All you need is to add " (indexed
text)" to the header for the "review" column - see 19.7 in the
documentation.

HTH,

John

P.S. I see you've already addressed at least one of the issues I raised
in my second message (before I saw the reply to my first).

Jack Jones

unread,
Dec 17, 2010, 2:56:59 PM12/17/10
to

Thank you so much for the tip with plurality. I was searching
desperately for a way to do that before I gave in and used the
additional table columns. The indexed text trick worked almost
perfectly. The only minor gripe I have with it is that it doesn't
preserve capitalization. Like, if the player types "review french
fries as the best I've ever eaten" it will be repeated as "you
reviewed the french fries 'as the best i've ever eaten.'" When I get
more time, I'll implement your other solutions and update you on how
they turn out. Again, thanks so much for all your help so far.

Captain Mikee

unread,
Dec 19, 2010, 11:27:36 PM12/19/10
to
Another tip regarding the use of "undescribed:" This is a somewhat
controversial property, not used in the library except for the
"yourself" object, and its use is discouraged. There are a few
alternatives for non-scenery objects that are mentioned in the room
description, and so should not be mentioned again. Here's one:

Rule for choosing notable locale objects for Dining Hall:
repeat with comestible running through food in Dining Hall:
set the locale priority of comestible to 0.

Probably even better would be to use Ron Newcomb's "Mentioned in Room
Description" extension:

http://inform7.com/extensions/Ron%20Newcomb/Mentioned%20In%20Room%20Description/doc_0.html

0 new messages