Using variables in "understand" clauses for nouns?

3 views
Skip to first unread message

ma...@mattweiner.net

unread,
Apr 21, 2009, 6:21:27 PM4/21/09
to
Hello raif! I'm a complete newbie at I7, so I apologize if this is
something that's already been covered somewhere.

However, perhaps it can serve as an example of where people get hung
up in learning I7, for the recent discussion.

Is there an easy way to write an "understand" clause with a variable
in it to allow the use of the possessive? I'd like to write something
along the lines of:

A nose is a kind of thing. Every person incorporates a nose.
Understand "[someone]'s nose" as the nose of the person.

but this doesn't compile. I thought that the problem might be that
there's no guarantee that every person has a unique nose, so I tried
something that (I think) guarantees uniqueness:

Lifting relates various people to one furniture (called the burden).
The verb to lift (he lifts, they lift, he lifted, it is lifted, he is
lifting) implies the lifting relation.
Understand "[someone]'s burden" as the burden of the person.

but that doesn't compile either; and in fact it's not the variable
that causes the problem, because:

Lifting relates various people to one furniture (called the burden).
The verb to lift (he lifts, they lift, he lifted, it is lifted, he is
lifting) implies the lifting relation.
Understand "the burden" as the burden of the player.

doesn't compile either. (In every case my error message is
"'understand ... as ...' should be followed by a meaning.")

Is the problem that "understand" should be followed by the name of an
object (if I want to access an object)? In that case, is there another
strategy that I should be using?

Thanks for any help anyone can give!

[Ultimately I'd like to be able to process "My pocket" as the pocket
of the pants that the player is wearing, but that seems far off.]

Jim Aikin

unread,
Apr 21, 2009, 7:38:58 PM4/21/09
to
On Apr 21, 3:21 pm, m...@mattweiner.net wrote:

> Is there an easy way to write an "understand" clause with a variable
> in it to allow the use of the possessive? I'd like to write something
> along the lines of:
>
> A nose is a kind of thing.  Every person incorporates a nose.
> Understand "[someone]'s nose" as the nose of the person.

Inform does that automatically -- although not with the player's nose.
To give a description to the player's nose, we have to resort to a bit
of subterfuge:

[code]
A nose is a kind of thing. A nose is part of every person.

Steve is a man in the Lounge. The description of Steve's nose is "Big
and warty." Understand "big" and "warty" as Steve's nose.

Bob is a man. The player is Bob.
The description of Bob's nose is "Small and turned up." The printed
name of Bob's nose is "your nose". Understand "my nose" and "mine" as
Bob's nose.
[end code]


> [Ultimately I'd like to be able to process "My pocket" as the pocket
> of the pants that the player is wearing, but that seems far off.]

No, that's easy:

The player wears some pants. A pocket is part of the pants. The pocket
is an open container. Understand "my pocket" as the pocket. Some car
keys are in the pocket.

The only catch is that if you've switched "the player" (which is a
sort of variable) to Bob, as shown earlier, then you have to say, "Bob
wears some pants."

I'll have to let someone else tackle the part of your question about
relations. I know very little about relations.

--JA

Jesse McGrew

unread,
Apr 21, 2009, 8:02:12 PM4/21/09
to
On Apr 21, 4:38 pm, Jim Aikin <midigur...@gmail.com> wrote:
> On Apr 21, 3:21 pm, m...@mattweiner.net wrote:
>
> > Is there an easy way to write an "understand" clause with a variable
> > in it to allow the use of the possessive? I'd like to write something
> > along the lines of:
>
> > A nose is a kind of thing.  Every person incorporates a nose.
> > Understand "[someone]'s nose" as the nose of the person.
>
> Inform does that automatically -- although not with the player's nose.

Apparently this only happens if you write "A nose is part of every
person" -- not if you phrase it as "Every person incorporates a nose".
But another problem is that if you let the player refer to Bob with
other names ("Robert", "man"), they still won't be able to refer to
"Robert's nose" or "the man's nose", because "Bob's" is a fixed part
of the object name.

Here's a more general way to do it without relying on Inform's
automatic naming:

<code>
Home is a room. Bob is a man in Home.

A nose is a kind of thing. Every person incorporates a nose.

Understand "[something related by reversed incorporation] 's" as a
nose.

Instead of examining a nose which is part of a person (called the
owner), say "This nose belongs to [the owner]."

After reading a command:
let X be indexed text;
let X be the player's command;
replace the text "'s" in X with " [']s";
change the text of the player's command to X.
</code>

Notes:

* The key is "[something related by reversed incorporation]": this
will match "Bob", or any other name that refers to Bob if he has
synonyms, but only for a nose that is incorporated by Bob.
Understanding based on relations is covered at 16.16 in the manual.

* The "after reading a command" rule is necessary to add a space
before the possessive apostrophe in the player's command, since
understanding operates on whole words at a time.

> > [Ultimately I'd like to be able to process "My pocket" as the pocket
> > of the pants that the player is wearing, but that seems far off.]
>
> No, that's easy:
>
> The player wears some pants. A pocket is part of the pants. The pocket
> is an open container. Understand "my pocket" as the pocket. Some car
> keys are in the pocket.
>
> The only catch is that if you've switched "the player" (which is a
> sort of variable) to Bob, as shown earlier, then you have to say, "Bob
> wears some pants."

That won't work for objects that are part of every person (like the
nose). Instead, use something like this:

<code>
Understand "my" as a nose when the item described is part of the
player.
</code>

This will still work if you change the player, or even if the player
is changed during the game.

vw

ma...@mattweiner.net

unread,
Apr 21, 2009, 8:13:29 PM4/21/09
to
Thanks Jim!

I see that my initial problem was that I wrote:
>
> > A nose is a kind of thing. Every person incorporates a nose.

and you wrote:
> [code]
> A nose is a kind of thing. A nose is part of every person.
>

and (as I checked by using showme) my method generates parts called
"nose" for both persons whereas the correct method (yours) generates
parts called "Steve's nose" and "Bob's nose." Interesting.

> > [Ultimately I'd like to be able to process "My pocket" as the pocket
> > of the pants that the player is wearing, but that seems far off.]
>
> No, that's easy:
>
> The player wears some pants. A pocket is part of the pants. The pocket
> is an open container. Understand "my pocket" as the pocket. Some car
> keys are in the pocket.
>
> The only catch is that if you've switched "the player" (which is a
> sort of variable) to Bob, as shown earlier, then you have to say, "Bob
> wears some pants."
>

Does this work if there is more than one pair of pants in the game,
and I
want "my pocket" to be the pocket of whatever pants the player is
wearing?
On a quick test it asked me for a disambiguation, but I may have
entered
it wrong.

(Eventually I'd like to do something where the viewpoint switches, so
I'll
be using the "Bob" formulation. Actually this might be a comment about
your handbook -- if you mention early on that you can change the
viewpoint
character, some foolhardy newbie is bound to try to mess around with
that before he's figured out how to do anything else!)

ma...@mattweiner.net

unread,
Apr 21, 2009, 8:25:29 PM4/21/09
to
Thanks Jesse! I hadn't seen your post when I posted my reply to Jim.
The code about "my" is just what I was looking for.

ma...@mattweiner.net

unread,
Apr 21, 2009, 10:19:54 PM4/21/09
to
On a closer look at Jesse's post, the lack of space after the
apostrophe was also causing a problem for me -- thanks for mentioning
that, I wouldn't have caught it on my own (and definitely wouldn't
have got that solution).
Reply all
Reply to author
Forward
0 new messages