SpecialTopic class | actor.t[3751], en_us.t[2743]

A "special" topic. This is a topic that responds to its own unique, custom command input. In other words, rather than responding to a normal command like ASK ABOUT or SHOW TO, we'll respond to a command for which we define our own syntax. Our special syntax doesn't have to follow any of the ordinary parsing conventions, because whenever our ConvNode is active, we get a shot at parsing player input before the regular parser gets to see it.

A special topic MUST be part of a ConvNode, because these are inherently meaningful only in context. A special topic is active only when its conversation node is active.

Special topics are automatically Suggested Topics as well as Topic Entries. Because special topics use their own custom grammar, it's unreasonable to expect a player to guess at the custom grammar, so we should always provide a topic inventory suggestion for every special topic.

Modified in en_us.t[2743]:
For SpecialTopic matches, treat some strings as "weak": if the user's input consists of just one of these weak strings and nothing else, don't match the topic.

`class SpecialTopic : TopicEntry SuggestedTopicTree`

Superclass Tree (in declaration order)

`SpecialTopic`
`TopicEntry`
`object`
`SuggestedTopicTree`
`SuggestedTopic`
`object`

Subclass Tree

(none)

Global Objects

(none)

Summary of Properties

`fullName includeInList keywordList matchPat name timesToSuggest weakPat`

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

``

Inherited from `SuggestedTopic` :
`associatedTopic curiositySatisfied location suggestionGroup suggestTo`

Summary of Methods

`getConvNode initializeSpecialTopic isMatchPossible matchPreParse matchTopic noteSuggestion`

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

Inherited from `SuggestedTopicTree` :
`associatedTopicIsActive associatedTopicTalkCount`

Inherited from `SuggestedTopic` :
`associatedTopicCanMatch findEnclosingSuggestedTopic findOuterSuggestedTopic fromEnclosingSuggestedTopic initializeSuggestedTopic isSuggestionActive`

Properties

`fullName` OVERRIDDEN | `actor.t[3816]`

our suggestion (topic inventory) full name is usually the same as the base name; special topics usually aren't grouped in topic suggestion listings, since each topic usually has its own unique, custom syntax

`includeInList` OVERRIDDEN | `actor.t[3822]`

include in the specialTopics list of our parent topic database

`keywordList` | `actor.t[3766]`

Our keyword list. Each special topic instance must define a list of strings giving the keywords we match. The special topic will match user input if the user input consists exclusively of words from this keyword list. The user input doesn't have to include all of the words defined here, but all of the words in the user's input have to appear here to match.

Alternatively, an instance can specifically define its own custom regular expression pattern instead of using the keyword list; the regular expression allows the instance to include punctuation in the syntax, or apply more restrictive criteria than simply matching the keywords.

`matchPat` | `actor.t[3805]`

our regular expression pattern - we'll build this automatically from the keyword list if this isn't otherwise defined

`name` OVERRIDDEN | `actor.t[3808]`

our suggestion (topic inventory) base name

`timesToSuggest` OVERRIDDEN | `actor.t[3830]`

By default, don't limit the number of times we'll suggest this topic. Since a special topic is valid only in a particular ConvNode context, we normally want all of the topics in that context to be available, even if they've been used before.

`weakPat` | `en_us.t[2762]`

Our "weak" strings - 'i', 'l', 'look': these are weak because a user typing one of these strings by itself is probably actually trying to enter the command of the same name, rather than entering a special topic. These come up in cases where the special topic is something like "say I don't know" or "tell him you'll look into it".

Methods

`getConvNode ( )` | `actor.t[3900]`

find our enclosing ConvNode object

`initializeSpecialTopic ( )` | `actor.t[3780]`

Initialize the special topic. This runs during pre-initialization, to give us a chance to do pre-game set-up.

This routine adds the topic's keywords to the global dictionary, under the 'special' token type. Since a special topic's keywords are accepted when the special topic is active, it would be wrong for the parser to claim that the words are unknown when the special topic isn't active. By adding the keywords to the dictionary, we let the parser know that they're valid words, so that it won't claim that they're unknown.

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

a special topic is always matchable, since we match on literal text

`matchPreParse (str, procStr)` | `actor.t[3867], en_us.t[2744]`

Match a string during pre-parsing. By default, we'll match the string if all of its words (as defined by the regular expression parser) match our keywords.

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

check for a match

`noteSuggestion ( )`OVERRIDDEN | `actor.t[3819]`

on being suggested, update the special topic history

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