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