Unexpected Behavior with ConsultTopic in adv3lite

I have been encountering some unexpected behavior when user input matches a ConsultTopic and the singular form of that input refers to a non-Topic object in the game.

[code]gameMain: GameMainDef
initialPlayerChar = me
;

startRoom: Room ‘Desert’
"There is nothing but dry sand as far as the eye can see. "
;

  • me: Thing ‘you’
    isFixed = true
    person = 2
    contType = Carrier
    ;

  • diary: Consultable ‘diary’;

++ ConsultTopic ‘(just )?deserts’
"In an entry dated 1960 March 3 the diary’s author
writes, Humphrey will be getting his just deserts on Friday. Then he
will be sorry he ever cut in line at the malt shop! "
;

++ DefaultConsultTopic
"You cannot find anything about that topic in the diary. "
;[/code]

Am I doing something wrong?

I’m pretty sure the problem is that you’re trying to use the name property syntax where the library is expecting a Regular Expression. (See p. 131 in Learning T3 with Adv3Lite.)

I skated around this by defining a separate Topic object. The code below seems to work:

[code]tDeserts: Topic ‘(just); desert deserts’
;

startRoom: Room ‘Desert’
"There is nothing but dry sand as far as the eye can see. "
;

  • me: Thing ‘you’
    isFixed = true
    person = 2
    contType = Carrier
    ;

  • diary: Consultable ‘diary’;

++ ConsultTopic @tDeserts
"In an entry dated 1960 March 3 the diary’s author
writes, Humphrey will be getting his just deserts on Friday. Then he
will be sorry he ever cut in line at the malt shop! "
;

++ DefaultConsultTopic
"You cannot find anything about that topic in the diary. "
;
[/code]

Thank you for the code.

But my string was a regular expression.

I probably should have shared this in my first post; if you go into my code and change the name of the room (to, say, ‘Dessert’), it becomes possible to get this output from the game:

In other words the code works exactly as expected.

I suspect that when the code is compiled the presence of “desert” in an object name causes “deserts” to be added to the lexicon, and this somehow prevents the ConsultTopic object from being matched. But I do not know enough about the inner workings of adv3lite to verify that this is the problem or resolve it.

This is almost certainly the case. If you define an object, adv3Lite automatically recognizes the plural of that name as referring to the object, so I suspect the parser matches ‘deserts’ to the desert object which then matches the DefaultConsultTopic. When I get a chance (which may not be for a day or two) I’ll check this out in the parser code, although at this point I don’t guarantee this behaviour can be changed without breaking something else!

I’ve now located and fixed the bug and uploaded the revised code to GitHub. The problem was that when a topic entered by the player matched a game object, the parser didn’t go on to create the additional dummy Topic object that would be needed to match the regular expression on any potentially interested TopicEntry. This additional dummy Topic object (encapsulating the text typed by the player) is now always created, except when the parser is attempting a pronoun match (when different rules apply; this exception may need revisiting in the future, but I’ll leave it in for now).

Thank you, once again, for all your hard work, Eric.