Supplying a missing noun when the second noun is provided.

I thought maybe the “supplying a missing noun activity” would help me in this situation, but it doesn’t seem to be doing anything.

I need a verb that is identical in syntax to “answering it that” - in this example, I’ve called it “forgiving it for”. So I copied the code for “answering it that”, which conveniently picks a missing noun if none is provided. But for some reason, my new action doesn’t do that, even when I add an extra “supplying a missing noun” rule. (there is no such rule for “answering it that”, but it works anyway).

[code]The Hallway is a room.

Bob is a man in the hallway.

forgiving it for is an action applying to one thing and one topic.

Understand “forgive [text] by [someone]” as forgiving it for (with nouns reversed)

Carry out forgiving it for:
say “‘I forgive you for the transgression of [the topic understood],’ you say to [the noun].”

Rule for supplying a missing noun while forgiving:
now the noun is Bob.

test me with “say hello to bob/say hello/forgive nose-picking by bob/forgive nose-picking”[/code]

Note that the parser says (to Bob) when I “say hello”, but not when I “forgive nose-picking”.

What do I have to do to make this work?

This is slightly tricky for a couple of reasons that unfortunately I don’t have time to get into real deeply at the moment. The clue to your problem is in this output:

Note that adding “by” makes it work correctly. The reason why your supplying a missing noun rule isn’t working is that you haven’t created a grammar line that recognizes the command without a noun. See this from 17.30. Supplying a missing noun/second noun. (I added the italicized part.)

Now the tricky part is that because you’ve made the thing the first noun and the topic the second noun, it becomes impossible to create the required grammar line. This is the part that would take some time to explain, so just trust me for now. :slight_smile: Switch the order of the tokens (making the topic the noun and the thing the second noun) and add the grammar for a missing person token and it will work. Remember to change all references to “the noun” to “the second noun.”[code]The Hallway is a room.

Bob is a man in the hallway.

forgiving it for is an action applying to one topic and one thing.

Understand “forgive [text] by [someone]” as forgiving it for.

Understand “forgive [text]” as forgiving it for.

Carry out forgiving it for:
say “‘I forgive you for the transgression of [the topic understood],’ you say to [the second noun].”

Rule for supplying a missing second noun while forgiving:
now the second noun is Bob.

test me with “say hello to bob/say hello/forgive nose-picking by bob/forgive nose-picking / forgive nose-picking by”.[/code]HTH

That all makes sense, and switching the order of tokens is a good idea for solving the problem, but why does “answering it that” still work? There’s no grammar line that matches, and yet it still picks “Bob” as a noun even when all you say is “say foo”.

I actually wrote a little hack that takes advantage of the flexibility of “answering it that”. Something along the lines of…

[code]Understand “forgive [text] by [someone]” as answering it that.

Instead of answering someone that something:
try forgiving the noun for the topic understood.[/code]

… and that worked too!

The fact is, I don’t really want to write a complete rule for supplying a missing noun - a custom message for when the player is alone would be enough. The built-in disambiguation of “answer it that” seems to work fine already, so I wanted to know how to hook into it with other verbs. Duplicating the work of identifying the one person in the room other than the player turned out to be non-trivial, and who wants to duplicate work anyway?

I believe it is coded as an exception deep within the parser itself. In other words, Answering doesn’t play fair, and to replicate the behavior you’d need to dig around in the I6 templates, parser.i6t, and modify that. Look for ##Answer for likely suspects.

I’m beginning to discover how much of I6 is still left in I7. When I first learned about it, I assumed that the Standard Library was entirely reimplemented in in I7. Actually, a lot of it is just hooks into the I6 code, yes?

“A lot” is a subjective measure. :slight_smile:

Most of the complex low-level features of I7 (table handling, list handling, rulebook handling, the parser itself) are I6 code. On the other hand, most of the model world code (standard actions) is I7 at this point.

Which you consider “a lot” depends on how deep you’ve hacked into the Inform cliff-face.