ActorState class | actor.t[2958]

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 autoSuggest 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 actorSay addToActor afterAction afterTravel arrivingTurn beforeAction beforeTravel canEndConversation deactivateState getBestMatch initializeActorState initiateConversation remoteSpecialDesc sayArriving sayDeparting sayFollowing`

Inherited from `EndConvBlocker` :
`blockEndConv`

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

Inherited from `TopicDatabase` :
`addTopic`

Properties

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

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[3088]`

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.

`autoSuggest` | `actor.t[3299]`

Flag: do we want the game to suggest topics of conversation after a TALK TO commmand when the actor is in this ActorState? By default we do.

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

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

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

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[2985]`

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

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

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[3161]`

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[3127]`

Flag -- has the player character just arrived?

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

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

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

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[3102]`

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

`actorSay (str)` | `actor.t[3287]`

Calling actorSay() on an ActorState calls actorSay() on its associated Actor.

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

Add this ActorState to our actor's list of ActorStates

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

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[3124]`

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[3094]`

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

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

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[3117]`

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[3137]`

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[3109]`

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[3171]`

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[2989]`

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

`initiateConversation (state, str)` | `actor.t[3293]`

Calling initiateConverstion() on an ActorState calls ainitiateConverstion() on its associated Actor.

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

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[3069]`

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[3062]`

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[3046]`

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 08/12/2025 from adv3Lite version 2.2.2