A plug-in topic database. The topic database is a set of TopicEntry objects that specify the responses to queries on particular topics. The exact nature of the queries that a particular topic database handles is up to the database subclass to define; we just provide the abstract mechanism for finding and displaying responses.
This is a "plug-in" database in that it's meant to be added into other classes using multiple inheritance. This isn't meant to be used as a stand-alone abstract topic entry container.
TopicDatabase : object
Superclass Tree (in declaration order)
Summary of Properties
Summary of Methods
Flag: this database level should limit topic suggestions (for the TOPICS and TALK TO commands) to its own topics, excluding any topics inherited from the "broader" context. If this property is set to true, then we won't include suggestions from any lower level of the database hierarchy. If this property is nil, we'll also include any topic suggestions from the broader context.
Topic databases are arranged into a fixed hierarchy for an actor. At the top level is the current ConvNode object; at the next level is the ActorState; and at the bottom level is the Actor itself. So, if the ConvNode's limitSuggestions property is set to true, then the suggestions for the actor will include ONLY the ConvNode. If the ConvNode has the property set to nil, but the ActorState has it set to true, then we'll include the ConvNode and the ActorState suggestions.
By default, we set this to nil. This should usually be set to true for any ConvNode or ActorState where the NPC won't allow the player to stray from the subject. For example, if a ConvNode only accepts a YES or NO response to a question, then this property should probably be set to true in the ConvNode, since other suggested topics won't be accepted as conversation topics as long as the ConvNode is active.
Our list of suggested topics. These are SuggestedTopic objects that describe things that another actor wants to ask or tell this actor about.
Is the topic group active? A TopicEntry always checks with its container to see if the children of the container are active. By default, everything in the database is active.
Get the score adjustment for all topic entries contained within. The default adjustment is zero; TopicGroup objects can use this to adjust the score for their nested entries.
Add a topic to our topic database. We'll add it to the appropriate list or lists as indicated in the topic itself. 'topic' is a TopicEntry object.
Add a topic to the given topic list. The topic list is given as a property point; for example, we'd specify &askTopics to add the topic to our ASK list.
Compare the vocabulary match strengths of two ResolveInfo objects, for the purposes of breaking ties in topic matching. Uses the usual comparison/sorting return value conventions: -1 means that a is weaker than b, 0 means they're equivalent, 1 means a is stronger than b.
findTopicResponse (fromActor, topic, convType, path)
find the best response (a TopicEntry object) for the given topic (a ResolvedTopic object)
Get the "owner" of the topics in this database. The meaning of "owner" varies according to the topic database type; for actor topic databases, for example, this is the actor. Generally, the owner is the object being queried about the topic, from the player's perspective. Each type of database should define this method to return the appropriate object.
handleTopic (fromActor, topic, convType, path)
Handle a topic. Look up the topic in our topic list for the given conversational action type. If we find a match, we'll invoke the matching topic list entry to handle it. We'll return true if we find a match, nil if not.
remove a topic from our topic database
remove a topic from the given topic list
showSuggestedTopicList (lst, asker, askee, explicit)
show our suggested topic list
showTopicResponse (fromActor, topic, resp)
show the response we found for a topic
TADS 3 Library Manual
Generated on 5/16/2013 from TADS version 3.1.3