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
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.
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.
The number of times this EventListItem has fired.
Have we finished with this EventListItem?
Is this EventListItem ready to fire? Note that this is addition to its not being done and having reached its ready time.
The last turn on which this EventListItem fired
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.
The minimum interval (in number of turns) between repeated occurrences of this item.
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.
The EventList object to which we are to belong. If this is left at nil, our location will be used.
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.
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
Otherwise, use our fallback routine.
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.
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.
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.
Add this EventListItem to the eventList of the EventList object with which is is to be associated.
The method that defines what this EventListItem does if it's invoked when it's not ready to fire.
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.
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.
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.
Set this EventListItem as having been done
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 03/07/2024 from adv3Lite version 2.1