does the player mean consulting it about

The reference section is a room. A book stand is a supporter. The huge encyclopedia is a thing. It is on the book stand. The book stand is in the reference section. Understand "encyclopaedia" as the encyclopedia. Understand "book" as the encyclopedia. Does the player mean doing something to the book stand: It is unlikely. Does the player mean doing something to the encyclopedia: It is likely. Does the player mean consulting the encyclopedia about: It is very likely. Does the player mean consulting the book stand about: It is very unlikely. Test me with "consult book about foo / x book"

When the player types CONSULT BOOK ABOUT FOO, none of these rules fire and the game defaults to the stand, which is silly. When the player types X BOOK or similar, the first 2 ensure that it is the encyclopedia. What am I missing? How can I make it so that CONSULT BOOK ABOUT FOO is understood as the encyclopedia and not the stand?

I didn’t check this, but I believe you need to put something after the “about” in “consulting the encyclopedia about.” If you don’t have any preferences there, you can literally just use “something”:

Does the player mean consulting the encyclopedia about something: It is very likely.

Sorry, that’s not it. I took out the “something” because it didn’t work, and then I ran out of ideas.

Ah, sorry, I just checked, and it needs to be “some text” after the about. I found this by looking up “consulting it about” in the Actions tab of the Index.

Edit: …except that doesn’t work either. Hrmmm.

Also untested, and also just stabbing in the dark, but what about “some topic” instead of “something”? Or, if that doesn’t work, “some text”? Or maybe there’s different syntax, but with the idea that you’re not consulting about things but about text. “Consulting it about is an action applying to one thing and one topic.”

-Kevin

“some topic” doesn’t work and we already tried “some text”.

Try “the topic understood” – this will match the topic already recorded by the understand line, whatever that may have been.

“topic understood” doesn’t work. Also, when I tried it with “rules all”, it didn’t even look at the “does the player mean” rules. OTOH the “x book” did look at the rules in question. Is this a bug in Inform?

Inform doesn’t see any need to disambiguate between the ‘book stand’ and the ‘huge encyclopedia’, since their internal names are perfectly distinct. (The understand assertion doesn’t change that.) Therefore, the does the player mean rules are not considered.

Adding “book” to the name of the huge encyclopedia (“the huge encyclopedia book”) means that the disambiguation machinery starts running.

However, that gives rise to another weird behaviour: the last word in the command “consult book about foo” influences the parser’s interpretation of “book”.

Even after putting “book” into the name of the encyclopedia, the parser will choose the book stand if the player types “consult book about foo” but the encyclopedia if the player types “consult book about huge”!

[code]The reference section is a room.

A book stand is a supporter. The huge encyclopedia book is a thing. It is on the book stand. The book stand is in the reference section. The printed name of the huge encyclopedia book is “huge encyclopedia”. Understand “encyclopaedia” as the encyclopedia.

Does the player mean doing something to the book stand:
It is unlikely.

Does the player mean doing something to the encyclopedia:
It is likely.

Does the player mean consulting the encyclopedia about the topic understood:
It is very likely.

Does the player mean consulting the book stand about the topic understood:
It is very unlikely.

Test me with “consult encyclopedia about foo / consult book about foo / consult book about huge / x book / x encyclopedia”.
[/code]

EDIT: Strangely enough the parser seems to choose the encyclopedia before the book stand as soon as one tries to “consult book about” something in scope …

Hmm, my game is inventoryless anyway, so maybe I should just have one object instead of 3 (the book stand, the encyclopedia, and an irrelevant object that’s part of the stand). But then parsing becomes a nightmare… Maybe I should just not call it a “book stand” in the first place (the word “stand” was already in use elsewhere, but I can just make it privately-named).

OK, I tested calling it a “book-stand” and then giving it the printed name “stand” and that worked. It’s close enough to what I wanted.

This is ridiculous. I suppose I should file a feature suggestion. Is it documented, though?

In addition to being ridiculous, it’s wrong: Inform does consult those rules when examining, it just fails to do so when consulting it about.

Oops! Sorry, about that. :blush:
Then my best guess about what’s happening is that something weird is going on.

I obviously shouldn’t be too sure, but now I think this is what happens: does the player see rules apparently don’t run when the topic is not an object in scope; the parser therefore chooses the book stand rather than the encyclopedia, since the former is in the location with the player, whereas the latter is not (it is on the stand, not in the reference section).

Some such line as Instead of consulting the book stand about anything when the player's command does not include "stand": if the player can see the encyclopedia, try consulting the encyclopedia about the topic understood; otherwise continue the action. can be used as a fix.

Is this behaviour (ignoring does the player mean rules for actions applying to a topic whenever the topic understood is not also an object in scope) to be considered a bug?

I used the TRACE 5 testing command on the original source to figure this out. Inform scores objects by various criteria and only runs Does The Player Mean if the scores are equal. The stand got an extra 20 points than the encyclopedia due to the location: the stand is in the player’s location, while the encyclopedia is neither in his location nor in his pocket. Hence the stand is preferred.

If you put the encyclopedia in the room but not on the stand you’ll get the which did you mean question, as expected.

I don’t think so.
The score is calculated by the ScoreMatchL routine (§38 in the Parser Template), and objects score for does the player mean rules after scoring for location or not being a direction but before scoring for not being scenery.

(ScoreMatchL calls ChooseObjects which calls ScoreDabCombo (both at §62 in Parser) which calls CheckDPMR (Standard Rules ch.2 §20) which runs the does the player mean rulebook.)

X BOOK will run the does the player mean rules, even if the encyclopedia is in the stand; and so will CONSULT BOOK ABOUT ME, CONSULT BOOK ABOUT STAND, CONSULT BOOK ABOUT BOOK, etc. (where the topic is an object in scope), whereas CONSULT BOOK ABOUT FTHAGN, CONSULT BOOK ABOUT SVENSKA AKADEMIEN, or CONSULT BOOK ABOUT IF-COMP (where the topic is not an object in scope) will not run them.

I7, I curse you! :smiling_imp:

I can’t tell you how many parsing problems I’ve had that are not solved by Does the Player Mean rules. They’re just not consulted enough. And even when they are, they don’t do any scoring between them - you have to be careful to order them so that exactly the right one fires. One day, one day I tell you, I’m going to rewrite that damn parser and expose all of its workings to I7!

Yeah, we need a “does the author mean [rule]” activity to resolve them…

I suspect you’re being a smartass, but I don’t quite understand your point… :confused:

What troubles me is that if only one DPMR can make a decision, why are there four different results? Why not just “yes” or “no?” Going the other way, why not make it like choosing notable locale objects activity, where you can have multiple rules in the After rulebook, each of which directly manipulate the score?

[code]Scoring the player’s command is an activity.

For scoring the player’s command: (- I6 Parser -)

After scoring the player’s command when the most likely action is consulting it about and a book is visible:
Set the noun score for the book-stand to 0;
Repeat with the tome running through visible books:
Increase the noun score for the tome by 10;[/code]

Yes, I’m being a smartass – the point is that the DTPM rules are a (probably too simplistic) attempt to solve an object precedence problem. Ordering rules in a rulebook is also a precedence problem; it’s exactly the same once you break it down to a mathematical model.

I still don’t have a solution, of course.

It’s not normally the case that only one rule decides the disambiguation outcome. The rulebook is run separately for each option (perhaps after the parser has pre-eliminated some options). Each option gets a score, and the option with the highest score wins.

Only one rule fires for each option. But it is (or can be) a different rule for each of the options.