ppf2f969ee.png
pp745d1a75.png
Eric Eve 16-Mar-07 Page 2
TADS 3.0.16
DYNAMIC CHARACTERS QUICK REFERENCE

ActorState

·
stateDesc - this is a message that's added to the actor's basic description (the "npcDesc" property in the Actor object). Most actors will have a permanent description that never changes - a basic description of their physical appearance - along with some extra information that describes what they're doing right now. The stateDesc lets you add this extra state-dependent part.
·
specialDesc - displays the actor's in-room description. This is the description displayed in the room description (for example, when entering the room, or in response to a LOOK command). By default, we'll invoke the actor's actorHereDesc method.
·
distantSpecialDesc - the special description of the actor from a distance.
·
remoteSpecialDesc(actor) - the special description of the actor from a remote location.
·
obeyCommand(issuingActor, action) - determine if we should obey the given action. By default, we'll simply refuse all commands and display any matching CommandTopic.
·
takeTurn() - this is called once per turn. This allows the actor to carry out scripted behaviour appropriate to the current state. This does nothing by default.
·
afterAction() - this method can contain code to be run after the PC performs an action in the NPC’s scope.
·
beforeAction() - this method can contain code to be run before the PC performs an action in the NPC’s scope; the action can be vetoed with an exit command.
·
beforeTravel(traveler, connector)
·
afterTravel(traveler, connector) - these methods are invoked just before and after a traveler travels via travelerTravelTo(); beforeTravel() is called on each object connected by containment to the traveler in its old location, and afterTravel() is called on each object connected by containment in the new location. These notifications are more precise than using beforeAction() and afterAction() with the TravelVia pseudo-action, because these actions are only called when travel is actually occurring. TravelVia will
fire notifications even when travel isn't actually possible. A beforeTravel() method can veto the travel action using "exit". The notification is invoked before the travel is actually performed, and even before a description of the departure is produced.
·
isInitState - if set to true, then the then the library will automatically set the corresponding actor's curState property to point to that ActorState during pre-initialization.
·
arrivingTurn() - When group travel is performed using the AccompanyingInTravelState class, this is essentially called in lieu of the regular takeTurn() method on the state that is coming into effect after the group travel.
·
autoSuggest - set to nil to disable automatic topic inventory listing on TALK TO commands.

HermitActorState
·
noResponse - explain why actor in this state is too busy or otherwise unresponsive.

Accompanying State
·
accompanyTravel(leadActor, conn) { return leadActor == gPlayerChar; } to make NPC follow player.
·
getAccompanyingTravelState(leadActor, conn)   { return new WhoeverTravelState(location, leadActor, self); }

AccompanyingInTravelState
·
    sayDeparting(conn) - the ‘before’ message
·
    specialDesc - the ‘after’ message

ConversationReadyState
·
inConvState - our in-conversation state object. This specifies the state to switch to when a conversation begins. This should be set to an InConversationState object. For your convenience, rather than defining this property explicitly, you can put the ConversationReadyState "inside" its corresponding InConversationState, using the '+' syntax. If a ConversationReadyState is nested within an InConversationState object, the library will automatically initialize the former's inConvState property to point to the containing state.
·
Greeting Protocols - use HelloTopic, ImpHelloTopic, ByeTopic, ActorByeTopic, BoredByeTopic,
LeaveByeTopic and ImpByeTopic, located in the ConversationReadyState. The ImpXXXTopic forms are for implicit greeting or parting; if absent, the XXXTopic entry will be used instead. Use ActorByeTopic, BoredByeTopic and LeaveByeTopic for particular types of implied parting.


 InConversationState
·
attentionSpan - this is an integer giving the number of turns the actor should wait before giving up on the conversation. The default is 4. If the other character doesn't talk to our NPC for this many turns, we'll automatically terminate the conversation, switching to our next state. If the NPC’s attention span is unlimited, set this to nil.
·
nextState - this is an ActorState object, which should usually be of the ConversationReadyState subclass, which follows the conversation's termination. When we terminate the conversation, we'll switch to this state. You don't have to override this; if you don't, we'll remember the state that the actor was in just before the conversation, and switch back to that state when the conversation ends.
Actor
·
initiateConversation(state, node) - see ConvNode
·
initiateTopic(obj) - used with InitiateTopic (q.v.)

TopicEntry Subclasses
·
AskTopic answers an ASK ABOUT question;
·
TellTopic responds to a TELL ABOUT command;
·
AskTellTopic answers either an ASK ABOUT or TELL ABOUT command;
·
GiveTopic responds to a GIVE TO command;
·
ShowTopic responds to a SHOW TO command;
·
GiveShowTopic responds to either a GIVE TO or SHOW TO command;  AskTellGiveShowTopic.
·
AskForTopic responds to an ASK FOR command
·
AskAboutForTopic, AskTellAboutForTopic
·
YesTopic responds to a YES command.
·
NoTopic responds to a NO command.
·
ByeTopic & ImpByeTopic & HelloGoodbyeTopic & ActorByeTopic & BoredByeTopic & LeaveByeTopic
·
HelloTopic & ImpHelloTopic - use these eight on a ConversationReadyState to provide greeting protocols