Hand VS my hand problem

I’ve noticed Inform can be loose (in a generous way) about the preposition ‘my’. But I’ve created a circumstance in which the player is unable to refer to their own hand by ‘my hand’, though I want them to be able to.

The following test recreates the circumstances from my WIP, where there’s a backdrop with the name of a body part, and an actual body part that’s part of the player. The only reason things are privately-named here is to match the circumstances of the WIP.

X HAND looks at the backdrop, but X MY HAND doesn’t match anything. Tweaking with ‘does the player means’ does not help. I can see from some TRACEing that the parsing of X MY HAND looks a bit weird (type 5 errors).

desert is a room.

john is a man in desert. the player is john.

hand-of-god is a privately-named backdrop. It is everywhere. Understand "hand" as hand-of-god.

a john-hand is a privately-named part of john. Understand "hand" as john-hand.

test me with "x hand/x my hand".



If I use body parts, I always define the PC’s separate from the NPCs.

(not tested, but this is usually the form)

a hand is a kind of thing. 
understand "hand/hands/finger/fingers/fingernails" as a hand. 
one hand is part of every man. 
one hand is part of every woman.

my hand is a hand. it is part of the player. 
the printed name of my hand is "your hand"

The parser will automatically name each NPC part like “john’s hand”.

Then if you make “hand” a synonym for the hand-of-god backdrop, the game will disambiguate whether you mean that every time the player checks their nails.

I don’t quite follow the theory, but my player isn’t the player-player. It’s someone I’ve necessarily moved into via ‘now the player is BLAH’.

Edit - OK, something I’m experimenting with is ‘understand “my hand” as john-hand’ (at least re: my shared example code). This seems to be working OK so far. I only need to do it when the relevant thing is a part of the player. For something they’re carrying, Inform handles an optional ‘my’ OK.


1 Like

Does this work?

Understand "my" as a thing when the item described is part of the player.
1 Like

That does seem to work. Thanks.


For what it’s worth, I think the underlying issue is due to this code from Adjudicate in Parser.i6t:

for (i=0 : i<number_matched : i++) {
        obj = match_list-->i; its_owner = parent(obj); its_score=0; met=0;

        !      if (indef_type & OTHER_BIT ~= 0
        !          &&  obj ~= itobj or himobj or herobj) met++;
        if (indef_type & MY_BIT ~= 0 && its_owner == actor) met++;
        if (indef_type & THAT_BIT ~= 0 && its_owner == actors_location) met++;
        if (indef_type & LIT_BIT ~= 0 && obj has light) met++;
        if (indef_type & UNLIT_BIT ~= 0 && obj hasnt light) met++;
        if (indef_owner ~= 0 && its_owner == indef_owner) met++;

        if (met < threshold) {
            #Ifdef DEBUG;
            if (parser_trace >= 4)
            	print "   ", (The) match_list-->i, " (", match_list-->i, ") in ",
            	    (the) its_owner, " is rejected (doesn't match descriptors)^";
            #Endif; ! DEBUG
            match_list-->i = -1;

This code first sets its_owner to parent(obj); the parent relation includes containment and support and carrying and wearing (I think) but not incorporation. Then “indef_type & MY_BIT ~= 0 && its_owner == actor” is the clause that has to do with whether “my” was one of the descriptors, so it’s going to come out true if the thing we’re checking is carried or worn, but not part of the player.

I think that if “its_owner = parent(obj)” were changed to “its_owner = HolderOf(obj)” then that would allow “my” to refer to parts of the player, since HolderOf returns the component parent or the tree parent, whichever is applicable. That shouldn’t affect the clause about “its_owner == actors_location” because rooms can’t have parts.

And I think the clause about indef_owner is used to check for pronouns like “his hand” and “her hand,” so if we wanted “my” to include parts we would probably also want those to include parts. So my guess is that changing parent(obj) to HolderOf(obj) would mean that possessive pronouns included parts as well as possessions. Whether this would be desirable… dunno.

(I guess one reason not to do make it a default is that it’s harder to switch off than to switch on.)