<code>
"The Face of Evil" by Xevious McGarnicle.
A face is a kind of thing. A face is part of every person.
eyes are a kind of thing. Eyes are part of every face.
The oval office is a room. Dubya is a person [loosely speaking] in the
oval office.
test me with "examine Dubya's eyes"
</code>
The output from this is: -
> examine dubya's eyes
You see nothing special about Dubya's face's eyes.
Whereas what I am aiming for is: -
> examine dubya's eyes
You see nothing special about Dubya's eyes.
I'm guessing that this way of describing things which are a part of
other things is more widespread than just the examine action, so I'd
like to amend this description style for all other actions too. I'm
already using the Custom Library Messages extension, if that has any
bearing on the question. Can anyone tell me how I might go about this?
I'm not an I7 user, but I've used both I6 and T3 pretty extensively,
so possibly I can help.
The question I'd ask is, why make the eyes part of the face at the
code level? Why not just make the eyes part of Dubya? You can write a
description that tells the _player_ they're part of the face, but
unless there's a reason at the code level why they need to be embedded
in the face (such as if the face is removable -- a mask), there may
not be a reason to insist that the object tree resemble reality.
--JA
Jim's suggestion is probably the simplest, but if you need the eye to
be part of the face for some other reason, you could add the
following:
Rule for printing the name of eyes which are part of a face which is
part of a person (called owner): say "[owner]'s eyes".
The reason the name is being printed the way it is that an object
which is part of another thing is given the default printed name
"[thing which it is a part of]'s [part]", so the face is "Dubya's
face" and the eyes are "(Dubya's face)'s eyes".
-JDC
How do you differentiate parts of something when multiple things have
the same part?
Some eyes are a part of every person.
Do you do "The eyes enclosed by Dubya are blue" (having defined blue
as a type of color?)
Thank you both for the replies. I'd like to save a lot of hassle by
taking Jim's suggestion, but the example I posted here was a
simplification of my actual situation; I do have a reason for requiring
that the eyes are part of the face rather than of the person directly.
JDC, I took your idea and tried to make it into a generic rule for
printing the name of things. In doing so, I found I don't know how to
get the "base name" of an object. I can't use the printed name of an
object in my "to say the printed name of..." phrase, because it just
causes an infinite loop (of course).
I need a way of writing something like [the base name of the thing],
where the "base name" is the exact name I gave the item in my source
code, bypassing any "to say the printed name of" phrases. Does anyone
know how I can get at this property?
Below is an example to demonstrate what I mean (this causes the infinite
loop I mentioned): -
<code>
A body part is a kind of thing.
A face is a kind of body part. A face is part of every person.
eyes are a kind of body part. Eyes are part of every face.
The oval office is a room. Dubya is a person in the
oval office.
Rule for printing the name of a body part (called X1):
if X1 is part of a thing:
say "[the ultimate parent of X1] [X1]";
otherwise:
say "[X1]".
To say the ultimate parent of (X1 - a thing):
if X1 is part of a thing (called X2):
say the ultimate parent of X2;
otherwise:
if X1 is the player:
say "my";
otherwise:
say "[X1]'s".
That does seem to work, although I'm not sure why. I would have thought
"enclosed by" would have implied the eyes were contained within Dubya,
rather than being a part of him.
The way I've been saying it is simply "Dubya's eyes are blue", which
also works fine, and perhaps reads a little more naturally in the source.
There doesn't seem to be a native I7 of way of doing this, but you can
do it with a bit of I6. What you want is the name of the kind of the
object, and the following seems to work:
To say kind name of (x - thing): (- print (I7_Kind_Name) {x}.&i7_kind--
>0; -).
Then you can modify your rule for printing the name to:
Rule for printing the name of a body part (called X1):
if X1 is part of a thing:
say "[the ultimate parent of X1] [kind name of X1]";
otherwise:
say "[X1]".
(keeping the ultimate parent part and the rest the same).
-JDC
That works beautifully, many thanks!