parser thinks game command is vocab word (adv3Lite)

I’m in a conversation with Lucy. Next topic up is ask her why you are here

The prompt ask her why you are here is the autoName for a QueryTopic…

My response, using TADS shorthand, is a why here and the response by the game is the non sequitur There’s no point trying to talk to a door. Say what? What door?

Well, the door in question is one of three doors at the apartment building entrance. The doors are door a, door b, and door c. In order to make it easy on the player, I’ve added a, b, and c to the vocab, so that when you say knock on door, the game says which door, you can say just a and the game will do the right thing…

[code]+ door300a: Door ->doorToLanding ‘door;to[prep] 300a a’
“The door is a plain wooden door with a brass
mail slot…etc.”


disambigName = 'door to 300a'



That all works.

But now, some time after we’ve gone through the door, and a couple of rooms distant so the door is no longer in scope, we get into a conversation with Lucy, where a why here should be a valid command-line entry, but the library thinks a is a vocab word, and it thinks we’re trying to address the door. The library makes that association at line 253 in command.t…

[code] foreach (local role in predRoles)
/* get the NPMatch list for this role */
local matches = self.(role.objListProp);

                /* get the list of names for this role's list of objects */
                local names = Distinguisher.getNames(
                    matches.mapAll({ m: m.obj }), nil);[/code]

When I stop there on a breakpoint after entering the shorthand command, the names list consists of door300a. If I comment out the final a in the door’s vocab, the conversation is correctly handled, but then, of course, the door nomenclature is broken. Doesn’t matter if I leave the a/b/c at the end of the vocab string or move it to the noun portion (door a, door b, door c). Still doesn’t work, and the disambiguation syntax gets more clunky (Which door, the door a, the door b, or the door c?)

Can this be fixed, or do I have to choose one or the other, conversation or door, and compromise on how I name the other?


This is odd; but the first thing I’d try to solve your immediate problem is to make ‘a’ ‘b’ and ‘c’ weak tokens in the vocab of the three doors by enclosing them in parentheses, along the lines of:

doorA: Door 'door (a)'; ;


doorA:Door 'door; (a)' ;

Depending on how you want the name of these doors to appear. This means that the doors should match “door a”, “door b” etc. but not just ‘a’ or ‘b’, which might solve your immediate problem.

Why the parser is interpreting A WHY HERE as an attempt to address DOOR A is another matter, which may take more looking into (which I don’t have time to do right now but will come back to when I do).

Okay. When you do get to it, I have some more insight as to what’s happening.

The conversation with Lucy is triggered with the gPlayerChar enters the Room named livingRoom. The doors a, b, and c are defined on the Room named aptLanding.

The livingRoom and aptLanding rooms are joined in a sense region.

When I remove aptLanding from the region and run the game, the spurious text does not appear. When I put it back, it does.

Also FWIW…

It does solve the problem of the spurious text appearing, but it also interferes with the reason I added a, b and c to the door vocab properties—so that the doors would match just a, b, or c, during disambiguation, so that the following would be possible…

As a workaround, I think you could use replaceVocab to fiddle with the vocabulary of the door objects in a roomAfterTravel method whenever the player enters or leaves aptLanding (untested, names of methods may be wrong, but I’ll bet it will work).

Yes, it works! Thanks.


This is odd, I edited my response with the fix, but the edit seems to have disappeared.

The problem is with VerbRule(QueryAbout) in grammar.t. You just need to change (‘ask’|‘a’|) to (‘ask’|‘a’) at the start of the VerbRule and the problem should be fixed.

Okay, thanks. I see the same i[/i] in the VerbRule definitions for Query and QueryVague. Should the same change be made for those as well as for QueryAbout?


2nd EDIT…

After making the changes (see 1st edit text, below) I then backed out of all but the one you said to make…:slight_smile:…and it seems to be working. That is, with just the QueryAbout change. But it kind of makes me wonder, is there a lurking time bomb here with that change? Will it come back to bite me with some other Query topic?


Ooops, made the changes (all three of them) and it’s not working.

Now the game breaks in a different conversation, with a different character, in a different room (unrelated to the sense region) earlier in the game, and I never reach the talk to the door problem (at least in the game script I’ve been using to get back to the same spot in the game each time).

[code]++ whatsBillDoing: QueryTopic ‘what’ @tWhatsBillDoing
“Wha… you start, as he pushes you. <.p>
autoName = true

tWhatsBillDoing: Topic ‘he is doing;you are’;[/code]

Now when I respond to the prompt what are you doing

…the game responds with a DefaultConversationTopic and the logic of the game comes to a halt…

No, the change should only be made for QueryAbout. The bug looks as if it was due to my copying the QueryAbout grammar from one of the others and not making all the necessary changes.

The erroneous VerbRule for QueryAbout read:

    ('a' | 'ask'|) singleDobj ('what' ->qtype | 'who' ->qtype | 
                               'where' -> qtype | 'why'
                   ->qtype | 'when' -> qtype| 'how' -> qtype | 'whether' ->
                    qtype | 'if' -> qtype)  topicIobj
    : VerbProduction
    action = QueryAbout
    verbPhrase = 'ask/asking (what)'
    missingQ = 'what do you want to ask'
    priority = 60

What that means is that in addition to ASK dobj WHO|WHAT|WHY|ETC WHATEVER and A ASK dobj WHO|WHAT|WHY|ETC WHATEVER, the VerbRule was also matching just dobj WHO|WHAT|WHY|ETC WHATEVER. So, in your original problem case A WHY I AM HERE (or whatever it was) was matching DOBJ WHY I AM HERE since A matched a potential dObj (Door A). The command A WHY HERE was thus being parsed as if you had typed ASK A WHY HERE, hence the strange response you got.

VerbRule(Query) on the other hand is correct as it stands:

    ('a' | 'ask'|) ('what' ->qtype | 'who' ->qtype | 'where' -> qtype | 'why'
                   ->qtype | 'when' -> qtype| 'how' -> qtype | 'whether' ->
                    qtype | 'if' -> qtype) topicDobj
    : VerbProduction
    action = Query
    verbPhrase = 'ask/asking (what)'
    missingQ = 'what do you want to ask'
    priority = 60

This is meant to match either ASK WHY HERE or A WHY HERE or WHY HERE, which is what it does.

That doesn’t surprise me. The change should only be made for QueryAbout! If you make the same change to the other two you’ll break them (as it seems you just found out). By making the change to VerbRule(Query) that you were meant to make (only) to VerbRule(QueryAbout) you of course stop VerbRule(QueryAbout) matching commands that start with WHO, WHAT, WHY, WHERE etc.

It certainly shouldn’t, since the bug that was causing your problem with Door A was very clearly a bug in the definition of VerbRule(QueryAbout). The grammar for that VerbRule was clearly wrong. Putting it right shouldn’t cause any problems elswhere.