EventListItemclass | eventListItem.t[21]

An EventListItem is an object that can be used within an EventList but is only used when certain conditions are met (its isReady property evaluates to true, the game clock time is at or after any next firing time we have defined, and it hasn't already been used for any maximum number of times we care to define).

EventListItems can be added to a regular EventList object by locating them within that object using the + notation. [EVENTLISTITEM EXTENSION]

`class EventListItem : PreinitObject`

Superclass Tree (in declaration order)

`EventListItem`
`PreinitObject`
`ModuleExecObject`
`object`

Subclass Tree

`EventListItem`
`ELI`
`ELI1`

Global Objects

(none)

Summary of Properties

`canRemoveWhenDone doneWhen fireCt isDone isReady lastClock maxFireCt minInterval missedTurn myListObj readyTime whichList`

Inherited from `PreinitObject` :
`execBeforeMe reverseGlobalSymbols`

Inherited from `ModuleExecObject` :
`execAfterMe hasInitialized_ isDoingExec_ isExecuted_`

Summary of Methods

`_invokeItem addToList canFire doScript execute fallBack fallBackResponse invokeItem setDelay setDone underused`

``

Inherited from `ModuleExecObject` :
`_execute classExec`

Properties

`canRemoveWhenDone` | `eventListItem.t[194]`

Flag: can this EventListItem be removed from its eventList once isDone = true? By default it can, but note that this flag only has any effect when our EventList's resetEachCycle property is true. We might want to set this to nil if isDone might become nil again on this EventListItem, to avoid it being cleared out of its eventList.

`doneWhen` | `eventListItem.t[209]`

An alternative condition (which could be defined as a method) which, if true, causes this EventListItem to be finished with (set to isDone = true). Note that isDone will be set to try either if this EventListItem exceeds its maaFireCt or if its doneWhen method/property evaluates to true.

`fireCt` | `eventListItem.t[186]`

The number of times this EventListItem has fired.

`isDone` | `eventListItem.t[177]`

Have we finished with this EventListItem?

`isReady` | `eventListItem.t[165]`

Is this EventListItem ready to fire? Note that this is addition to its not being done and having reached its ready time.

`lastClock` | `eventListItem.t[212]`

The last turn on which this EventListItem fired

`maxFireCt` | `eventListItem.t[201]`

The maximum number of times we want this EventListItem to fire. The default value of nil means that this EventListItem can fire an unlimited unmber of times. For an EventListItem that fires only once, set maxFireCt to 1 or use the ELI1 subclass.

`minInterval` | `eventListItem.t[221]`

The minimum interval (in number of turns) between repeated occurrences of this item.

`missedTurn` | `eventListItem.t[117]`

This first turn on which we came up in our EventList but were unable to fire, or nil if we have either not missed or turn or fired on the previous occasion we could.

`myListObj` | `eventListItem.t[60]`

The EventList object to which we are to belong. If this is left at nil, our location will be used.

`readyTime` | `eventListItem.t[218]`

The turn count that must be reached before we're ready to fire. By default this is 0, but game code can use this or set the setDelay() method to set/reset it.

`whichList` | `eventListItem.t[54]`

we usually want to add objects to a ShuffledEventList's eventList property, but items/subclasses could change this to be added to firstEvents or some other alternate list within the EventList object

Methods

`_invokeItem ( )` | `eventListItem.t[84]`

Otherwise, use our fallback routine.

`addToList (myListObj_, whichList_, =, &, eventList, minInterval_?)` | `eventListItem.t[270]`

Add this EventListItem to the whichList list of myListObj_. If specificied, whichList must be supplied as a property, and otherwise defaults to &eventList. A minimium interval between firings of this EventList item can optionally be specified in the minInterval_ parameter, but there is no need to do this if this EventList already defines its own minInterval or doesn't require one.

`canFire ( )` | `eventListItem.t[171]`

Can this EventListItem item fire? By default it can if its isReady condition is true and it is not already done (isDone != true) and the turn count exceeds its ready time.

`doScript ( )` | `eventListItem.t[66]`

When the event list to which we've been added gets to us, it will call our doScript() method, so we use that to define what happens.

`execute ( )`OVERRIDDEN | `eventListItem.t[26]`

Add this EventListItem to the eventList of the EventList object with which is is to be associated.

`fallBack ( )` | `eventListItem.t[124]`

The method that defines what this EventListItem does if it's invoked when it's not ready to fire.

`fallBackResponse ( )` | `eventListItem.t[158]`

The response to use if all else fails, that is if there we cannot fire ourselves and there is no non-EventListItem (which could be used in our place) in the eventList to which we belong. This could, for exmple, display another message or it could just do nothing, which is the default. We only need to supply something here if we belong to an EventList that should display something every turn, for example as a response to a DefaultTopic or else if we are or may be the final item in a StopEventList.

`invokeItem ( )` | `eventListItem.t[109]`

Here goes the code (or a double-quoted string) that carries out what we do when we're invoked. Game code will need to define what should happen here.

`setDelay (turns)` | `eventListItem.t[228]`

Set the number of turns until this EventListItem can be used again. This could, for example, be called from invokeItem() to set a minimum interval before this EventListItem is repeated.

`setDone ( )` | `eventListItem.t[180]`

Set this EventListItem as having been done

`underused ( )` | `eventListItem.t[252]`

Has this EventListItem been underused? By default it has if it hasn't been used at all or it missed out the last time it was called by not being ready, but game code can override if it wants to employ some other condition, such as the number of times we've been used in relation to other items in our listObj. The purpose of this is to allow RandomFiringScripts to prioritize underused EventListItems once they become ready to fire.

Adv3Lite Library Reference Manual
Generated on 01/03/2024 from adv3Lite version 1.6.2