TopicMatchTopic class | actor.t[2783]

A "topic match" topic entry. This is a topic entry that matches topic phrases in the grammar.

Handling topic phrases is a bit tricky, because they can't be resolved to definitive game-world objects the way ordinary noun phrases can. Topic phrases can refer to things that aren't physically present, but which are known to the actor performing the command; they can refer to abstract Topic objects, that have no physical existence in the game world at all; and they can ever be arbitrary text that doesn't match any vocabulary defined by the game.

Our strategy in matching topics is to first narrow the list down to the physical and abstract game objects that both match the vocabulary used in the command and are part of the memory of the actor performing the command. That much is handled by the normal topic phrase resolution rules, and gives us a list of possible matches. Then, given this narrowed list of possibilities, we look through the list of objects that we're associated with; we effectively intersect the two lists, and if the result is non-empty, we consider it a match. Finally, we also consider any regular expression that we're associated with; if we have one, and the topic phrase text in the command matches the input, we'll consider it a match.

`class TopicMatchTopic : TopicEntry`

Superclass Tree (in declaration order)

`TopicMatchTopic`
`TopicEntry`
`object`

Subclass Tree

`TopicMatchTopic`
`AskTellTopic`
`AskAboutForTopic`
`AskForTopic`
`AskTellAboutForTopic`
`AskTopic`
`TellTopic`
`ConsultTopic`
`TopicOrThingMatchTopic`
`AskTellGiveShowTopic`
`AskTellShowTopic`

Global Objects

(none)

Summary of Properties

`matchExactCase matchPattern`

Inherited from `TopicEntry` :
`altTalkCount altTopicList impliesGreeting includeInList isActive isConversational matchObj matchScore talkCount topicGroupActive topicGroupScoreAdjustment topicResponse`

Summary of Methods

`findMatchObj isMatchPossible matchTopic setTopicPronouns`

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

Properties

`matchExactCase` | `actor.t[2800]`

no description available

`matchPattern` | `actor.t[2799]`

A regular expression pattern that we'll match to the actual topic text as entered in the command. If 'matchExactCase' is true, we'll match the exact text in its original upper/lower case rendering; otherwise, we'll convert the player input to lower-case before matching it against the pattern. In most cases, we'll want to match the input no matter what combination of upper and lower case the player entered, so matchExactCase is nil by default.

Note that both the object (or object list) and the regular expression pattern can be included for a single topic entry object. This allows a topic entry to match several different ways of entering the topic name, or to match several different topics with the same response.

Methods

`findMatchObj (obj, rt)` | `actor.t[2876]`

Match an individual item from our match list to the given ResolvedTopic object. We'll check each object in the resolved topic's "in scope" and "likely" lists.

`isMatchPossible (actor, scopeList)`OVERRIDDEN | `actor.t[2893]`

It's possible for us to match if any of our matchObj objects are known to the actor. If we have no matchObj objects, we must be matching on a regular expression or on a custom condition, so we can't speculate on matchability; we'll simply return true in those cases.

`matchTopic (fromActor, topic)`OVERRIDDEN | `actor.t[2814]`

Match the topic. By default, we'll match to either the simulation object or objects in matchObj, or the pattern in matchPattern. Note that we always try both ways of matching, so a single AskTellTopic can define both a pattern and an object list.

'topic' is a ResolvedTopic object describing the player's text input and the list of objects that the parser matched to the text.

Subclasses can override this as desired to use other ways of matching.

`setTopicPronouns (fromActor, topic)`OVERRIDDEN | `actor.t[2926]`

set the topic pronouns

TADS 3 Library Manual
Generated on 8/21/2012 from TADS version 3.1.2