AltTopicclassactor.t[2668]

An alternative topic entry. This makes it easy to define different responses to a topic according to the game state; for example, we might want to provide a different response for a topic after some event has occurred, so that we can reflect knowledge of the event in the response.

A set of alternative topics is sort of like an inverted if-then-else. You start by defining a normal TopicEntry (an AskTopic, or an AskTellTopic, or whatever) for the basic response. Then, you add a nested AltTopic located within the base topic; you can add another AltTopic nested within the base topic, and another after that, and so on. When we need to choose one of the topics, we'll choose the last one that indicates it's active. So, the order of appearance is essentially an override order: the first AltTopic overrides its parent TopicEntry, and each subsequent AltTopic overrides its previous AltTopic.

+ AskTellTopic @lighthouse "It's very tall.";
++ AltTopic "Not really..." isActive=(...);
++ AltTopic "Well, maybe..." isActive=(...);
++ AltTopic "One more thing..." isActive=(...);

In this example, the response we'll show for ASK ABOUT LIGHTHOUSE will always be the LAST entry of the group that's active. For example, if all of the responses are active except for the very last one, then we'll show the "Well, maybe" response, because it's the last active response. If the main AskTellTopic is active, but none of the AltTopics are active, we'll show the "It's very tall" main response, because it's the last element of the group that's active.

Note that an AltTopic takes its matching information from its parent, so you don't need to specify a matchObj or any other matching information in an AltTopic. You merely need to provide the response text and the isActive test.

class AltTopic :   TopicEntry

Superclass Tree   (in declaration order)

AltTopic
        TopicEntry
                object

Subclass Tree  

(none)

Global Objects  

(none)

Summary of Properties  

altTalkCount  altTopicOrder  impliesGreeting  includeInList  isConversational 

Inherited from TopicEntry :
altTopicList  isActive  matchObj  matchScore  talkCount  topicGroupActive  topicGroupScoreAdjustment  topicResponse 

Summary of Methods  

checkIsActive  initializeAltTopic  isMatchPossible  matchPreParse  matchTopic  noteInvocation  setTopicPronouns 

Inherited from TopicEntry :
addAltTopic  addSuggestedTopic  addTopic  adjustScore  anyAltIsActive  breakTopicTie  deferToEntry  getActor  getTopicOwner  handleTopic  initializeTopicEntry  noteAltInvocation 

Properties  

altTalkCountOVERRIDDENactor.t[2756]

our AltTopic counter is the AltTopic counter for the enclosing topic

altTopicOrderactor.t[2742]
Our relative order within our parent's list of alternatives. By default, we simply return the source file ordering, which ensures that static AltTopic objects (i.e., those defined directly in source files, not dynamically created with 'new') will be ordered just as they're laid out in the source file.

impliesGreetingOVERRIDDENactor.t[2730]
take our implied-greeting status from our parent

includeInListOVERRIDDENactor.t[2685]
include in the same lists as our parent

isConversationalOVERRIDDENactor.t[2733]
take our conversational status from our parent

Methods  

checkIsActive ( )OVERRIDDENactor.t[2700]

Determine if this topic is active. An AltTopic is active if its own isActive indicates true, AND none of its subsequent siblings are active.

initializeAltTopic ( )actor.t[2688]
AltTopic initialization

isMatchPossible (actor, scopeList)OVERRIDDENactor.t[2674]
we can match if our parent can match

matchPreParse (str, pstr)actor.t[2678]
we can match a pre-parse string if our parent can

matchTopic (fromActor, topic)OVERRIDDENactor.t[2670]
we match if our parent matches, and with the same score

noteInvocation (fromActor)OVERRIDDENactor.t[2745]
note invocation

setTopicPronouns (fromActor, topic)OVERRIDDENactor.t[2681]
set pronouns for the topic

TADS 3 Library Manual
Generated on 5/16/2013 from TADS version 3.1.3