[I6] ASK HER causes programming error

I found the offending chunk of code.: https://gitlab.com/DavidGriffith/inform6lib/-/blob/master/parser.h#L3152
It looks like this:

    if (match_length == 0 && indef_mode && indef_wanted ~= 100)
        number_matched = 0;  ! ask question for 'take three'

It doesn’t seem to correspond to anything the commit references in the comments. Here’s the old one: https://gitlab.com/DavidGriffith/inform-2006/-/commit/ed1595b58f9ce51ad5c66e532e9cf109630a488f

Does anyone know for what purpose these two lines were written? Cedric Knight committed them in 2004 and I haven’t heard from him in a long time.

1 Like

I think I found the problem. It was an irritatingly slippery bug to track down. A fix is in the askher branch. I’ll be hammering on the code for a couple days to make sure the fix doesn’t break anything before I merge it into the master branch.

1 Like

I just applied the change and did a quick test in my current game and it appears to be fixed. Congratulations @DavidG. That was a pretty obscure bug to track down. I’ll continue testing and let you know if I find any side effects.

Hmmm. It’s not perfect. Here’s a sample transcript:

>show ring to her
"That's it! Where did you find it?"

>show her ring
You can only do that to something animate.

>show witch ring
"That's it! Where did you find it?"

This is unrelated to ASK HER ABOUT <something>, but it signifies that there is still something deeper down that is causing issues.

The grammar for these commands is:

Verb 'show' 'display' 'present'
    * creature held                             -> Show reverse
    * held 'to' creature                        -> Show;

so they should give exactly the same results. The witch is defined as animate female, pronouns indicates that ‘her’ refers to the witch, but the creature token is misbehaving when the creature and held tokens are reversed.

Do you see the same misbehavior when the NPC is not female?

It doesn’t look like it. I’m just trying to track it down.

It looks like the call to NounDomain() is incorrect. When you use “witch”, NounDomain is called at word 2 and returns witch. When you use “her”, NounDomain is called at word 3 (which is wrong) and returns ring. Obviously, ring is not animate and this causes the error.

I’ve been trying to track this down and I’ll be stuffed if I can find it. It looks like wn (for word number) is being set to the wrong value prior to calling NounDomain(), but only when you use GIVE HER <object> or SHOW HER <object>. None of this makes sense, but the library code is too obtuse for a simpleton like me to work it out. The more I delve, the more other obscure bugs I find. I think I’ll leave it to the experts.

I’m going to call this business about SHOW HER RING versus SHOW RING TO HER a different bug. Could you file a new bug report about it?

It seems like in this case “her” really is ambiguous between a possessive and an indirect object, though. If it was “take her ring” then you would want “her ring” to be the noun.

You beat me to it. I see you’ve already raised a bug, so I’ve added a comment with what little I’ve been able to determine.

Based on @matt_weiner’s comment, I’m now wondering whether this has something to do with the possessive form. The masculine form would be ‘his’, whereas the feminine form would be ‘her’. If so, I didn’t know you could even use the possessive form in Inform commands.

Here’s a little bit of transcript from my game that demonstrates the possessive form of ‘her’ after giving the ring to the witch. I think this only works because I was smart enough to put the ring in the witch and make her transparent so that you could see her belongings. This is using the bleeding edge library with the ask her bug fixed.

>x witch
She's a withered old crone with dark skin, probably a druid. She looks happy now that she has her ring.

>take her ring
The ring seems to belong to the witch.

>take ring
The ring seems to belong to the witch.

>take her
I don't suppose the witch would care for that.

I’m guessing the trouble with SHOW HER RING is the tokens are wrong. It seems like the Library has decided that you’re trying to SHOW NOUN and NOUN being HER ROCK, which is invalid given the following chunk from grammar.h:

Verb 'show' 'display' 'present'
    * creature held                             -> Show reverse
    * held 'to' creature                        -> Show;

The next step seems to be to trace how HER gets processed through the whole library as it has to do with SHOW and how it decides what kind of pronoun is being used.

It also strikes me that the possessive pronoun may be getting priority when it is ambiguous. I don’t think that should be the case.

As you rightly pointed out on GitLab, the earlier fix was causing this problem. When I rolled back, the new problem was fixed and the old problem returned.

In the meantime, I also discovered that the “fix” had caused GET ALL and DROP ALL to fail Goodness knows why. You would think they were unrelated.

It seems to me that the old 2006 fix for TAKE THREE is faulty. We’ll have to come up with a less broken way of handling that.

I think I’ve fixed this one as much as it’s going to get fixed. Here are commit notes for anyone who’s interested:

Fixed Roger Firth's TAKE THREE clarification code.

Part of Roger's commit back in 2006 was intended to ask for
clarification when you try to TAKE THREE.  The intent was to have the
library ask "What do you want to take?".  Prior to this, TAKE THREE
would cause two of anything to be taken -- not desirable.  The
indef_wanted global variable indicates the number of items wanted when
indefinite mode is active.  A value of 100 means all as in TAKE ALL.  It
makes no sense though to want to refer to zero items when in indefinite
mode.  This is what was happening when this code block was triggered.  I
believe that's what directly led to the mysterious results when dealing
with a female NPC. While this fix does cure the problem of giving
replies like this:

(the witch about that)
I use them to make magic potions.

What does remain is this:

(to the witch)
That's it!  Where did you find it?

Like before, this parenthesized text isn't shown when the NPC is not
female.  However, this behavior is more acceptable than "(the witch
about that)".  To completely cure this problem, I think some work needs
to be done on distinguishing between HER as a personal pronoun and HER
as a possessive pronoun.

I filed a new issue covering the repeated trouble with HER as a personal pronoun getting confused with HER as a possessive pronoun. See https://gitlab.com/DavidGriffith/inform6lib/-/issues/104. Please create a new thread if you find more trouble. I’ll close this thread now.