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

I7: Articles preceding vowels

1 view
Skip to first unread message

Snacky Pete

unread,
Dec 21, 2009, 9:53:15 PM12/21/09
to

I have the following code, which is part of a sentence-construction system I'm working on.
It is intend to place "An open " in front of the container's name if it is indeed open.
Otherwise, I just want to print the name of the container. In the latter case, my problem
is in generating the approprate article to precede it.

To say openable name of (O - a container):
if O is open:
say "An open [O]";
otherwise:
say "[An O]";

My problem is in determining how to get I7 to print the aritcle properly for containers
whose names begin with a vowel. In the last line of my code, I want it to print examples
like "A window ..." and "An apple ..." but I can't figure out the method of doing that.
The above example just prints out "A apple". Am I going to have to disect the name of the
container and work from that? Surely something better is built into the system? At the
very least, there should be some extension code that already does this?

-Pete

Jim Aikin

unread,
Dec 21, 2009, 10:07:33 PM12/21/09
to

Inform does that by default. For instance:

The player carries an orange and a peach.

Instead of jumping:
say "You are carrying:[line break]";
repeat with item running through things held by the player:
say "[an item][line break]".

This code is not complete, but it works. It prints out "an orange" and
"a peach". So ... can you post a more complete version of your code,
including its output?

--JA

George Oliver

unread,
Dec 21, 2009, 10:14:47 PM12/21/09
to
On Dec 21, 6:53 pm, Snacky Pete <snackyp...@hotmail.com> wrote:

> My problem is in determining how to get I7 to print the aritcle properly for containers
> whose names begin with a vowel.

If you didn't define the object with its indefinite article (or for
some reason Inform isn't recognizing it), you can set it with 'the
indefinite article of apple is an'. For example:

<code>
"article"

R is a room.

A container called the apple is in R. Apple is closed. The indefinite
article of apple is "an".

To say openable name of (O - a container):
if O is open:
say "An open [O]";
otherwise:

say "[An O]".

When play begins:
say openable name of Apple.
</code>

Snacky Pete

unread,
Dec 21, 2009, 10:30:24 PM12/21/09
to

Jim: You were right about how Inform should handle articles. This is how I thought it
was, too, but for some reason it wasn't working the way I thought it should.

George: You are right too, about the use of the indefinite article property.

Pete: Is an idiot. After reading through both of your messages I had a closer look at my
code and found that at some point I had forced the "apple" container to have the
indefinite article of "a", thereby ensuring the behaviour I was getting. In other words,
everything was working as it should.

I think I need to take a break for the rest of the day.

Thanks, guys!

-Pete

0 new messages