Multiple AskTopics

Still struggling with conversations. This time it’s AskTopics. Here is my code derived from the Learning T3 document:

[code]startRoom: Room ‘start room’ ‘start room’ "Start room. ";
+me: Actor;

robert: Person ‘robert’ ‘robert’ "Robert. ";

mary: Person ‘mary’ ‘mary’ @startRoom "Mary. "
isHer = true
isProperName = true

  • maryTalking: ActorState
    isInitState = true
    specialDesc = "Mary is looking at you. "

  • TopicGroup
    isActive = true // MODIFIED FROM (mary.curState is in (maryWalking, maryTalking))
    ++ AskTopic @mary "blah blah mary ";
    ++ AskTopic @robert "blah blah robert ";[/code]

I get a response for “ask about mary”, but no response for “ask about robert.”

ask about mary
(asking mary)
blah blah mary

ask about robert
Mary does not respond.


Mary is located @startRoom together with player character, but Robert does not. So player can ask Mary about herself, but Robert is not in the room (Robert isn’t located anywhere). And therefore player and Mary doesn’t meet him and therefore doesn’t know he even exists. Player knows about objects he seen in the game world unless you explicitly mark object with isKnown = true property and then you can talk about such object even before you first see it.


  • TopicGroup
    isActive = true // MODIFIED FROM (mary.curState is in (maryWalking, maryTalking))
    Just one side note - TopicGroup is a nice tool to control activity of bunch of topics at one place instead of setting isActive on every single topic, but it is usually necessary only in few specific situations, when you need a bunch of topics available in more then one ActorState, but not all. I suppose that maryWalking is ConversationReadyState. You don’t need topics (apart from Hello/GoodbyeTopic) in this state since it won’t have any effect, conversation is always switched from ConversationReadyState into InConversationState when player asks something, so effectively your (commented out) code means isActive = mary.curState == maryTalking and therefore you can just place such topics under maryTalking with plus signs.

Ah, I see (said the blind man to the deaf woman as he picked up his hammer and saw). So if I want to ask an npc about something, the player has to already encountered it either via game play or explicitly in code. Thanks.