An "agenda item." Each actor can have its own "agenda," which is a list of these items. Each item represents an action that the actor wants to perform - this is usually a goal the actor wants to achieve, or a conversational topic the actor wants to pursue.
On any given turn, an actor can carry out only one agenda item.
Agenda items are a convenient way of controlling complex behavior. Each agenda item defines its own condition for when the actor can pursue the item, and each item defines what the actor does when pursuing the item. Agenda items can improve the code structure for an NPC's behavior, since they nicely isolate a single background action and group it with the conditions that trigger it. But the main benefit of agenda items is the one-per-turn pacing - by executing at most one agenda item per turn, we ensure that the NPC will carry out its self-initiated actions at a measured pace, rather than as a jumble of random actions on a single turn.
Note that NPC-initiated conversation messages override agendas. If an actor has an active ConvNode, AND the ConvNode displays a "continuation message" on a given turn, then the actor will not pursue its agenda on that turn. In this way, ConvNode continuation messages act rather like high-priority agenda items.
class
AgendaItem : object
Superclass Tree (in declaration order)
AgendaItem
object
Subclass Tree
AgendaItem
BoredomAgendaItem
ConvAgendaItem
FactAgendaItem
DelayedAgendaItem
FollowAgendaItem
Global Objects
(none)
Summary of Properties
agendaOrder
calledBy
endCondition
executeOnce
initiallyActive
invokedByActor
isDone
isReady
name
Summary of Methods
actorSay
getActor
invokeItem
invokeItemBase
registerItem
report
resetItem
Properties
The ordering of the item relative to other agenda items. When we choose an agenda item to execute, we always choose the lowest numbered item that's ready to run. You can leave this with the default value if you don't care about the order.
The object from whose agendaList this AgendaItem was invoked
If specified, an expression or method that evaluates to true when this AgendaItem has oompleted its task and wants to set isDone to true. This is checked both immediately before and immediately after invokeItem() is called (since calling invokeItem might change the game state). This is provided as a conveniant alteranative to handling isDone from with invokeItem(), which may still be necessary in some cases, such as when you want an AgendaItem simply to execute once (although you can also use the executeOnce property for that).
Flag: do we want this AgendaItem to execute once and once only?
Is this item active at the start of the game? Override this to true to make the item initially active; we'll add it to the actor's agenda during the game's initialization.
invokeItem can test the invokedByActor property to decide whether what the actor says should be a conversational gambit started on the actor's own initiative or as a (default) response to something the pc has just
Is this item done? On each turn, we'll remove any items marked as done from the actor's agenda list. We remove items marked as done before executing any items, so done-ness overrides readiness; in other words, if an item is both 'done' and 'ready', it'll simply be removed from the list and will not be executed.
By default, we simply return nil. Items can override this to provide a declarative condition of done-ness, or they can simply set the property to true when they finish their work. For example, an item that only needs to execute once can simply set isDone to true in its invokeItem() method; an item that's to be repeated until some success condition obtains can override isDone to return the success condition.
In some cases, it may be more convenient to set the endCondirion property to define when isDone should be set to true.
Is this item ready to execute? The actor will only execute an agenda item when this condition is met. By default, we're ready to execute. Items can override this to provide a declarative condition of readiness if desired.
An optional tag, specified as a single-quoted string.
Methods
Another convensence method; calling actorSay() on an AgendaItem calls actorSay() on its associated Actor.
My actor - agenda items should be nested within the actor using '+' so that we can find our actor. Note that this doesn't add the item to the actor's agenda - that has to be done explicitly with actor.addToAgenda().
Execute this item. This is invoked during the actor's turn when the item is the first item that's ready to execute in the actor's agenda list. We do nothing by default.
The caller is passed as a parameter so we can tell whether we're being called from an Actor or from a DefaultAgendaTopic, which may affect what we want to do -- for example the wording of what the actor says at this point.
Carry out any additional registration when we're added to our actor's agenda. We do nothing here, but this is needed on FollowAgendaItem.
A convenience method that can be used from within our invokeItem to display some text only if the player character can see us (or, if the optional second parameter is supplied, sense us through some other sense, e.g. &canHear or &canSmell).
Reset the item. This is invoked whenever the item is added to an actor's agenda. By default, we'll set isDone to nil as long as isDone isn't a method; this makes it easier to reuse agenda items, since we don't have to worry about clearing out the isDone flag when reusing an item.
Adv3Lite Library Reference Manual
Generated on 03/07/2024 from adv3Lite version 2.1