InConversationState class | actor.t[4967]

The "in-conversation" state. This works with ConversationReadyState to handle transitions in and out of conversations. In this state, we are actively engaged in a conversation.

Throughout this implementation, we assume that we only care about conversations with a single character, specifically the player character. There's generally no good reason to fully model conversations between NPC's, since that kind of NPC activity is in most cases purely pre-scripted and thus requires no special state tracking. Since we generally only need to worry about tracking a conversation with the player character, we don't bother with the possibility that we're simultaneously in conversation with more than one other character.

`class InConversationState : ActorState`

Superclass Tree (in declaration order)

`InConversationState`
`ActorState`
`TravelMessageHandler`
`object`
`ActorTopicDatabase`
`TopicDatabase`
`object`

Subclass Tree

(none)

Global Objects

(none)

Summary of Properties

`attentionSpan nextState previousState`

Inherited from `ActorState` :
`autoSuggest getImpliedConvState isInitState location stateDesc stateSuggestedTopics`

``

Inherited from `ActorTopicDatabase` :
`askForTopics askTopics commandTopics giveTopics initiateTopics miscTopics showTopics specialTopics tellTopics`

Inherited from `TopicDatabase` :
`limitSuggestions suggestedTopics topicGroupActive topicGroupScoreAdjustment`

Summary of Methods

`activateState deactivateState defaultGreetingResponse endConversation handleConversation takeTurn`

Inherited from `ActorState` :
`afterAction afterTravel arrivingTurn arrivingWithDesc beforeAction beforeTravel construct distantSpecialDesc getActor getNominalTraveler getSuggestedTopicList getTopicOwner initializeActorState justFollowed notifyTopicResponse obeyCommand remoteSpecialDesc showSpecialDescInContents specialDesc specialDescListWith suggestTopicsFor`

Inherited from `TravelMessageHandler` :
`sayArriving sayArrivingDir sayArrivingDownStairs sayArrivingLocally sayArrivingThroughPassage sayArrivingUpStairs sayArrivingViaPath sayDeparting sayDepartingDir sayDepartingDownStairs sayDepartingLocally sayDepartingThroughPassage sayDepartingUpStairs sayDepartingViaPath sayTravelingRemotely`

Inherited from `ActorTopicDatabase` :
`initiateTopic showTopicResponse`

Inherited from `TopicDatabase` :
`addSuggestedTopic addTopic addTopicToList compareVocabMatch findTopicResponse handleTopic removeSuggestedTopic removeTopic removeTopicFromList showSuggestedTopicList`

Properties

`attentionSpan` | `actor.t[4979]`

Our attention span, in turns. This is the number of turns that we'll be willing to stay in the conversation while the other character is ignoring us. After the conversation has been idle this long, we'll assume the other actor is no longer talking to us, so we'll terminate the conversation ourselves.

If the NPC's doesn't have a limited attention span, set this property to nil. This will prevent the NPC from ever disengaging of its own volition.

`nextState` | `actor.t[4987]`

The state to switch to when the conversation ends. Instances can override this to select the next state. By default, we'll return to the state that we were in immediately before the conversation started.

`previousState` | `actor.t[5170]`

The previous state - this is the state we were in before the conversation began, and the one we'll return to by default when the conversation ends. We'll set this automatically on activation.

Methods

`activateState (actor, oldState)`OVERRIDDEN | `actor.t[5118]`

activate this state

`deactivateState (actor, newState)`OVERRIDDEN | `actor.t[5152]`

deactivate this state

`defaultGreetingResponse (actor)` | `actor.t[5094]`

provide a default HELLO response, if we don't have a special TopicEntry for it

`endConversation (actor, reason)`OVERRIDDEN | `actor.t[5005]`

End the current conversation. 'reason' indicates why we're leaving the conversation - this is one of the endConvXxx enums defined in adv3.h.

This method is a convenience only; you aren't required to call this method to end the conversation, since you can simply switch to another actor state directly if you prefer. This method's main purpose is to display an appropriate message terminating the conversation while switching to the new state. If you want to display your own message directly from the code that's changing the state, there's no reason to call this.

This returns true if we wish to allow the conversation to end, nil if not.

`handleConversation (otherActor, topic, convType)`OVERRIDDEN | `actor.t[5051]`

handle a conversational command

`takeTurn ( )`OVERRIDDEN | `actor.t[5105]`

As our default response, point out that we're already at the actor's service. (This isn't an error, because the other actor might not have been talking to us, even though we thought we were talking to them.)

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