TopicAction and adv3lite [Solved]

I seem to be missing something fundamental about how to create a TopicAction with adv3lite, but for the life of me I cannot figure out what it is. Here is some relevant sample code:

[code]gameMain: GameMainDef
initialPlayerChar = me

tSummer: Topic ‘summer’;

(‘remember’) topicDobj
: VerbProduction
action = Remember
verbPhrase = ‘remember / remembering (what)’
missingQ = ‘what do you want to remember’

if(gTopicMatch == tSummer)
"{I} remember{s/ed} what {i} did last summer. ";
"{I} {do} not remember that. ";

startRoom: Room ‘Bedroom’
"Not the most original setting for an IF work, but a great place
to write one. "

  • me: Actor ‘Karona;;; her’
    isFixed = true
    person = 2
    contType = Carrier
    globalParamName = ‘me’
    And this is what happens after I compile and run it:

[rant]>remember last summer
You do not remember that.[/rant]
What I would have liked to have seen in response was, “You know what you did last summer.”

How do I make this work?

I don’t know details about adv3lite. That said, the word “last” you used in the command is neither part of the grammar nor part of the topic so it can’t match.

You are right!

Unfortunately the problem remains even if the right command (“remember summer”) is used.

I have found a “duct tape solution” (if I may steal a phrase DavidW used on ifMUD) by changing the relevant line of code to the following:

if(gTopicText == 'summer')

Of course, it would be more satisfying to have a solution that involves interacting with the topic only as opposed to the topic’s text. So if anyone has other ideas, I would be happy to hear them.

Ok, now I thought about it more. Topic object itself doesn’t do anything itself, conversations are modelled in a way that individual responses are presented as objects contained in some TopicDatabase (which is for example Actor or Consultable). You would need to follow the source code in library to understand it - on Actor there is a method findBestResponse(prop, topic) which in turn calls getBestMatch in actor state and if not found the in Actor itself and that will go though topics in database and find best match. It all starts by calling handleTopic on Actor, for example handleTopic(&askForTopics, gCommand.iobj.topicList);

On the other hand conversation commands involve some target Actor to whom the player character is tallking and in your case the player character talks to himself when he remembers something, so in your case you would need to adapt handling accordingly. And thats the point where I’ve realized that adv3lite already has something similar. In thoughts.t library file there is a mechanism handling “think about topic”, which allows you to create ThoughtManager object and locate several Thought objects in it (which are used same way as other TopicEntries, so you program them same way as conversation topics matching things and topics), like (untested):

[code]myThoughts: ThoughtManager;

  • Thought @tSummer
    "{I} remember{s/ed} what {i} did last summer. "

  • DefaultThought
    "{I} {do} not remember that. "

Now you can “think about last summer” and need to extend grammar of the ThinkAbout command to also allow “remember”, probably something like:

VerbRule(ThinkAbout2) 'remember' topicDobj : VerbProduction action = ThinkAbout verbPhrase = 'remember/remembering (what)' missingQ = 'what do you want to remember' ;

This is the sort of solution I would have wanted to find, had I known what to look for. Thank you! Thank you!