intfiction.org

The Interactive Fiction Community Forum
It is currently Sat Jul 21, 2018 10:15 pm

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Sat Jan 06, 2018 6:50 pm 
Offline

Joined: Thu Oct 07, 2010 3:10 pm
Posts: 49
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';

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

DefineTopicAction(Remember)
   execAction(cmd)
   {
      if(gTopicMatch == tSummer)
      {
         "{I} remember{s/ed} what {i} did last summer. ";
      }
      else
      {
         "{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: show
>remember last summer
You do not remember that.

What I would have liked to have seen in response was, "You know what you did last summer."

How do I make this work?


Last edited by Karona on Wed Jan 10, 2018 3:03 pm, edited 2 times in total.

Top
 Profile Send private message  
Reply with quote  
PostPosted: Sun Jan 07, 2018 11:20 am 
Offline

Joined: Sat Jul 16, 2011 3:48 pm
Posts: 285
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.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Sun Jan 07, 2018 2:44 pm 
Offline

Joined: Thu Oct 07, 2010 3:10 pm
Posts: 49
tomasb wrote:
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:

Code:
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.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Tue Jan 09, 2018 2:20 am 
Offline

Joined: Sat Jul 16, 2011 3:48 pm
Posts: 285
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:
Code:
VerbRule(ThinkAbout2)
    'remember' topicDobj
    : VerbProduction
    action = ThinkAbout
    verbPhrase = 'remember/remembering (what)'
    missingQ = 'what do you want to remember'
;


Top
 Profile Send private message  
Reply with quote  
PostPosted: Tue Jan 09, 2018 11:33 pm 
Offline

Joined: Thu Oct 07, 2010 3:10 pm
Posts: 49
tomasb wrote:
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):

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


Top
 Profile Send private message  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: Bing [Bot] and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group