[I6] Referring to body parts with "your"

Many text-based RPG games support interaction with body parts. For instance,

>scratch my left eyebrow You scratch your left eyebrow.

And:

>equip bracer to my left forearm You equip the steel bracer to your left forearm.

However, when I attempt to model this sort of thing in Inform 6 for an individual player, I see things like this:

>scratch my left eyebrow You scratch the left eyebrow.

I noticed that while the Inform 6 english module defines constants for things like YOURSELF__TX, YOU__TX, and even MYSELF__TX in Inform 6.12, there are no constants for “your”.

It has also been very difficult for me to find examples of referring to objects which can only ever actually belong to the player. Using the search function for these forums is especially challenging, and I can still find a handful of threads discussing body part modeling in Inform 7, but was unable to discover anything for Inform 6. Please bear with me, I realize Inform 6 is a quite a bit outdated. Eventually, I would like to adopt Inform 7, but for now, I’m focusing my efforts exclusively on Inform 6, for reasons.

Supposedly, I could alter the article, but then NPC actions would display incorrectly.

Alice scratches your left eyebrow.

I’d like to come up with some way of presenting the articles used in the body part interaction display messages in such a way that they will work for all cases and perspectives.

This means that the same methodology should work for a player:

You scratch your left eyebrow.

As well as for an NPC, as seen from the player’s perspective:

Alice scratches her left eyebrow.

Auto-created body parts can have some strange naming behavior, which seems to be what’s ailing you. It would be helpful to see your body part code, but this is should work as an example. (Warning: Written without access to the compiler, based on existing code)

A body part is a kind of thing. The indefinite article of a body part is usually "a".
A body part has some text called owner's pronoun.
Understand the owner's pronoun property as describing a body part. 

When play begins:
	Repeat with part running through the body parts:
		If part is part of the player:
			Now owner's pronoun of part is "my";		
		Else if part is part of a man:
			Now owner's pronoun of part is "his";
		Else if part is part of a woman:
			Now owner's pronoun of part is "her";
		Else:
			Now owner's pronoun of part is "their";

Workshop is a room.

A head is a kind of body part. A head is a part of every person. [1]

Joe is a man in Workshop. The player is Joe. [2]

Test me with "x head/ x your head / x my head"

By changing the order of line 1 and 2 you will also change the name of your head.

It’s also helpful to let your report rules take the actor into account, such as this:

Report an actor dressing (this is the report dressing rule):
	If the player is the actor:
		Say "[We] [put] on [our] clothes." (A);
	Else if the player can see the actor:
		Say "[The actor] [put] on [our] clothes." (B);

Ahem I believe Nels is asking about Inform 6, not Inform 7.

(Nels, it’s probably a good idea to put “I6” in your subject heading, or you wind up with a lot of Inform 7 help…)

Thank you, Matt. I’ll do that from now on.

This is the sort of thing that I come across for I7 in this forum, and it appears to be quite similar to what I’m trying to achieve in I6.

https://intfiction.org/t/a-detailed-clothing-system-work-in-progress/10696/1

I am pretty satisfied with the modeling I have worked up in I6 already. The only sticking point appears to be the pronouns/articles being displayed in verb interaction messaging.

This is a deficiency in the i6 library to which I haven’t given much thought. Precisely what release of the i6 library are you using?

At first I thought that giving the body part an article property of “your” would allow what you’re trying to do. This only works as far as describing the object, not interacting with it. Tomorrow I’ll poke around and see if I can have “(the)” processing do something sensible or if I’ll need to introduce an “owner” property to do the job. It seems simple enough.

1 Like

I am using Inform 6.33 – Release 6.12.1 – Serial number 160605.

That’s something I had wanted to be able to tinker around with myself as well, but I have never been able to figure out where support for (the) is implemented. I figured it was a language builtin and gave up trying to customize it. Is that the case? Or does it leverage the [ ©Defart; ]; function?

I poked around and found the places that need to be edited. I started issues on this at inform7.com/mantis/view.php?id=1998. Now I just need some time alone to do the work. Thanks for pointing this out.

1 Like

Thank you for looking into this, David!

Yes, I6 print statements that use (the) are compiled directly into calls to DefArt(). And CDefArt(), InDefArt(), etc in the obvious way.

Print (name) is compiled as PrintShortName(), which is a little less obvious.

1 Like

I’m making some progress with this. Right now I’m working on describing the object. Consider this:

Object Foot "foot"
  with name "foot",
  owner Girl,
  description [;
    Possessive(self.owner, true, true);
    print " ", (name) self, "^";
  ];

This is supported by a rewritten Possessive() function. I added an “owned” parameter to tell Possessive() that it should use a possessive noun instead of a possessive pronoun.

[ Possessive obj caps owned;
    if (obj == player) {
        if (player provides narrative_voice) switch(player.narrative_voice) {
          1:  if (caps) print "M"; else print "m"; print "y"; return;
          2:  ! Do nothing.
          3:  CDefart(player);
              print "'s"; return;
          default: RunTimeError(16, player.narrative_voice);
        }
        if (caps) print "Y"; else print "y";
        print "our"; return;
    }
    if (owned) {
        CDefart(obj);
        print "'s";
        return;
    }
    if (caps) print "H"; else print "h";
    if (obj has male) { print "is"; return; }
    if (obj has female) { print "er"; return; }
    if (caps) print "I"; else { print "i"; print "ts"; return; }
];

This results in a response like this:

> EXAMINE FOOT
The girl's foot.

That’s good, but I run into a problem if I make the player the owner of the object. I get this when compiling the code:

$ inform +./ test.inf 
Inform 6.34 for Unix (5th March 2016)
line 56: Error:  Expected constant but found <expression>
>  owner player,

Looking around, I see this near the beginning of parser.h:

Global player;

Now, here’s a question primarily for Zarf or David Kinder (or anyone else who really understands the compiler core): Why can’t a Global be put into a property? I see no other way to make this possessive modification work.

1 Like

Just a thought:

My current modeling relies on a dynamic tree traversal and caching of the owner for a body part. The tree traversal returns the owner object when it reaches an object in the tree to which the body part belongs and which does not inherit from my BodyPart class.

Like this:

[code]

Class BodyPart
with body_owner NULL,
owner [;
if (self.body_owner == NULL) {
self.body_owner = find_body_owner();
}
return self.body_owner;
],
find_body_owner [ o;
o = self;
while (o ofclass BodyPart) {
o = parent(o);
}
return o;
];

BodyPart Foot “foot”
with name “foot”,
description [;
Possessive(self.owner(), true, true);
print " ", (name) self, “^”;
];[/code]

Having body parts nested in this way results in a little weirdness when one looks at them, but I’m hoping to be able to override the messaging involving children of supporters at the BodyPart class level. And of course, I’ll also have to figure out how to prevent the BodyPart instances from showing up in the inventory.

Sorry, I missed this in the thread.

Property initial values are defined at compile time. Global initial values are also defined at compile time. The declaration

Global player;

is equivalent to

Global player = 0;

So zero is the only value that the compiler could infer for that property declaration. That’s not what you want, obviously.

Given your response, I’m getting the idea that short of messy and ill-advised fiddling with the compiler’s source code, it’s impossible to initialize a property with “player”. It seems that the only choice for this is to initialize to “playerobj” or whatever other instance of SelfClass the author has created. Comments?

David, did you see my post regarding the method by which I obtain the owner of a body part at runtime?

I think the need to set the owner property explicitly within the modeling can be avoided. (viewtopic.php?f=7&t=21349&p=118863#p118728)

I have no idea how the PrefaceByArticle method works, but by adding a single line to the [ ©DefArt; ] methods, I have been able to achieve the language I was looking for when using (the). if (o provides owner && o.owner ofclass Routine && o.owner() == player) return "your ", (name) o;

However, I have to explicitly use a special set of methods for externally directed messaging from NPCs to the player.

Not the exact code I’m using, but along these lines:

[code]
[ hisorher o, perspective; return Citsortheir(o, perspective); ];
[ Citsortheir o, perspective;
! Will need another of these for lower-case text.

if (o provides owner && o.owner ofclass Routine)
  owner_obj = o.owner();
else
  ! invoke some other default routine
  owner_obj = parent(o);

! IDK if this one is necessary if I support it in the player-oriented messaging routines for (the)
if (perspective == 1 && owner_obj == player) return "Your ", (name) o;

if (owner_obj has pluralname)      return "Their ", (name) o;
if (owner_obj has animate)
  if (owner_obj has female)        return "Her ", (name) o;
  else if (owner_obj hasnt neuter) return "His ", (name) o;
return "Its ", (name) o;

];[/code]

These are clearly hacks. So anything that could be added to support messaging around such an owner property in the proper library routines would be fantastic.

I did see it and I think it’ll work nicely. I forgot to mention that I started thinking that my modification may eventually be useful for assigning ownership to any object. For instance:

> LOOK AT TABLE
Upon the table is John's sword.

> GIVE BAG OF GOLD TO JOHN
John smiles, takes the bag, and pushes the sword towards you.

> LOOK AT TABLE
Upon the table is your sword.

Is this something you want to see? How shall I proceed?

Wow, that would be really interesting.

I had only planned on expressing ownership for either things actually in the player’s object tree or meta-ish objects which could only ever belong to the player.

I’m certain a case could be made for general ownership, but I’ve never seen such a model expressed in any other IF games. It’s always explicitly “your” within some prefabricated messaging (like the tortoise feather in Balances 961216), or article-ized with “your” (the satchel in Toyshop 961111) – of course this means that the player would see messages like

Alice opens your satchel.

even if you weren’t carrying the satchel anymore. That seems like the sort of thing that should be left to the discretion of the designer, and the example of setting the article of the satchel to “your” seems sufficient for now. If a designer wished to implement a more detailed ownership system to support things like mercantile exchanges, then adding the article “your” after purchase would seem sufficient so long as an object could inherit from a class which would add the ownership messaging to the name of the printed object as has been done for John’s sword, but only for objects currently in John’s inventory.

On the other hand, if one wanted to support ownership within a multi-player environment, like Guncho, then the system you’re proposing would seem to be a hard requirement.