ActorState class | actor.t[2690]

An ActorState represents a state (possibly one of many) an actor can be in or get into. This can control how the actor is described and the actor's response to certain conversational commands and other actions.

ActorStates should always be located directly in the Actor to which they belong.

`class ActorState : EndConvBlocker ActorTopicDatabase`

Superclass Tree (in declaration order)

`ActorState`
`EndConvBlocker`
`object`
`ActorTopicDatabase`
`TopicDatabase`
`object`

Subclass Tree

(none)

Global Objects

(none)

Summary of Properties

`active attentionSpan getActor informOverheard isInitState mood noResponse pcJustArrived specialDesc stateDesc`

``

Inherited from `ActorTopicDatabase` :
`askForTopics askTopics commandTopics defaultAgendaTopic giveTopics initiateTopics miscTopics queryTopics sayTopics sceneEndTopics sceneStartTopics showTopics talkTopics tellTopics`

``

Summary of Methods

`activateState addToActor afterAction afterTravel arrivingTurn beforeAction beforeTravel canEndConversation deactivateState getBestMatch initializeActorState remoteSpecialDesc sayArriving sayDeparting sayFollowing`

Inherited from `EndConvBlocker` :
`blockEndConv`

Inherited from `ActorTopicDatabase` :
`getListableTopics initiateTopic listableTopics suppressedList`

Inherited from `TopicDatabase` :
`addTopic`

Properties

`active` | `actor.t[2879]`

The active property is used by any TopicGroups and TopicEntries located directly within us to determine whether they in turn are active. Normally there is no reason for game code to override this on an ActorState; the property is simply provided so that TopicGroups and TopicEntries can call location.active regardless of whether they're located in TopicGroups, ActorStates or Actors.

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

Our actor's attention span while our actor is in this ActorState. This is the number of turns the actor will wait for the player character to say something when a our actor is the player character's current conversation partner, before our actor gives up on the conversation and terminates it through 'boredom'. A value of nil (the default) means our actor is infinitely patient and will never terminate a conversation for this reason.

`getActor` | `actor.t[2808]`

Our associated actor. This is set to our location at preinit by our initializeActorState method.

`informOverheard` | `actor.t[3010]`

Should other actors who can notionally hear the PC talking to us overhear when information is imparted to us and we're in this ActorState? I.e. should their setInform() methods be called too? By default they should.

`isInitState` | `actor.t[2717]`

Set isInitState to true if you want this ActorState to be the one the associated Actor starts out in.

`mood` | `actor.t[3016]`

The actor's mood when the actor is in this atate. If this is nil the actor uses the value of the actorMood property instead.

`noResponse` | `actor.t[2893]`

If the noResponse method is defined (i.e. non-nil) then this ActorState will behave like a TADS 3 HermitActorState, i.e. the noResponse message will be displayed in response to any conversational command

noResponse can be either a single-quoted string, a double-quoted string or a method. If it's a string then it will be displayed instead of any TopicEntry. It it's a method it will be executed; if it then displays anything no attempt will be made to match a TopicEntry, but it if doesn't display anything the conversational command will go on to be handled as normal.

`pcJustArrived` | `actor.t[2859]`

Flag -- has the player character just arrived?

`specialDesc` | `actor.t[2703]`

The specialDesc from the actor's current ActorState is used as the specialDesc for that actor in a room listing.

`stateDesc` | `actor.t[2697]`

The stateDesc from the actor's current ActorState is appended to the desc defined on the actor when the actor is described via an EXAMINE command.

Methods

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

Activate the state - this is called when we're about to become the active state for an actor. We do nothing by default.

`addToActor ( )` | `actor.t[2745]`

Add this ActorState to our actor's list of ActorStates

`afterAction ( )` | `actor.t[2763]`

The afterAction() method is called on an actor's current ActorState when the actor is in scope for the action that's just taken place. This allows game code to define state-specific reactions.

`afterTravel (traveler, connector)` | `actor.t[2856]`

The afterTravel notification triggered when the Actor is in this ActorState and traveler has just traveled via connector. By default we do nothing.

`arrivingTurn ( )` | `actor.t[2826]`

the arrivingTurn method is executed when an actor in this state has just followed the player char to a new location.

`beforeAction ( )` | `actor.t[2771]`

The beforeAction() method is called on an actor's current ActorState when the actor is in scope for the action that's just about to take place. This allows game code to define state-specific reactions.

`beforeTravel (traveler, connector)` | `actor.t[2849]`

The beforeTravel notification triggered when the Actor is in this ActorState and traveler is just about to travel via connector. By default we do nothing.

`canEndConversation (reason)` | `actor.t[2869]`

Determine whether our actor will allow a current conversation to be terminated for reason when in this ActorState. Return true to allow the conversation to be terminated and nil otherwise. By default we simply return true. If we return nil we should also display a message explaining why we're not allowing the conversation to end.

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

Deactivate the state - this is called when we're the active state for an actor, and the actor is about to switch to a new state. We do nothing by default.

`getBestMatch (prop, requestedList)`OVERRIDDEN | `actor.t[2903]`

The getBestMatch() method is already defined on TopicDatabase, from which ActorState inherits via ActorTopicDatabase. ActorState overrides it to allow certain modifications particular to ActorState, such as the possibility that the prop parameter might be passed as either a list or a property pointer to a list property, and the need to take into account the actor's activeKeys list.

`initializeActorState ( )` | `actor.t[2721]`

Initialize this ActorState (this is actually called at preinit).

`remoteSpecialDesc (pov)` | `actor.t[2710]`

If our associated actor is viewed from a remote location, use the ActorState's remoteSpecialDesc to describe the actor in a room listing. By default we just use the specialDesc.

`sayArriving (fromLoc)` | `actor.t[2801]`

The message to display when the player char sees this actor arriving after traveling from loc. By default we simply use our actor's sayActorArriving(fromLoc) method.

`sayDeparting (conn)` | `actor.t[2794]`

Display a message saying that our associated actor (typically an NPC whose departure is being viewed by the player character) is departing via conn. By default we simply use our actor's sayActorDeparting(conn) method.

`sayFollowing (oldLoc, conn)` | `actor.t[2778]`

Display a message saying that we're following the player character from oldLoc when our actor is in this ActorState (and the actor is following the player character)

Adv3Lite Library Reference Manual
Generated on 03/07/2024 from adv3Lite version 2.1