RuleBookclassrules.t[20]

A RuleBook is a container for one or more rules. Calling the follow() method of a RuleBook causes each of its contained rules to be executed in turn until one returns a non-null value. That value is then returned to the caller of the RuleBook. [DEFINED IN RULES EXTENSION]

class RuleBook :   PreinitObject

Superclass Tree   (in declaration order)

RuleBook
        PreinitObject
                ModuleExecObject
                        object

Subclass Tree  

(none)

Global Objects  

afterRules  beforeRules  initRules  preinitRules  reportRules  turnEndRules  turnStartRules 

Summary of Properties  

actor  contents  contValue  defaultVal  matchObj  stopValue 

Inherited from PreinitObject :
execBeforeMe  reverseGlobalSymbols 

Inherited from ModuleExecObject :
execAfterMe  hasInitialized_  isDoingExec_  isExecuted_ 

Summary of Methods  

addToContents  follow  initBook  removeFromContents 

Inherited from ModuleExecObject :
_execute  classExec  execute 

Properties  

actorrules.t[30]

The actor to use for comparison with the who property for rules in this RuleBook. The default is gPlayerChar, but for some RuleBooks gActor may be more appropriate.

contentsrules.t[23]
A list of rules contained in this rulebook

contValuerules.t[120]
contValue (continue value) is the value that a Rule in this RuleBook needs to return to avoid the RuleBook stopping at that Rule (rather than going on to consider more Rules). By default this is null, which means by default a Rule that does not explicitly return a value (and so effectivelt returns nil) will stop the RuleBook. If you want the default behaviour for this RuleBook to be not for Rules to stop the book, then override this to nil. [RULES EXTENSION]

defaultValrules.t[131]
The default value to return to our caller. By default this is the same as our contValue , to make it easy to test whether we any rule returned a non-null value. By default a rule that does something will return nil, so if no rule does anything we want to return a different value. By making the defaultValue the same as the contValue, we ensure that we can tell our caller that no rule was executed (if that is indeed the case). [RULES EXTENSION]

matchObjrules.t[153]
The object (or any other value) to be matched by our Rule's matchObj conditions if they have any. This property is set by our follow() method (from its first argument) and so should not normally be directly changed from game code. [RULES EXTENSION]

stopValuerules.t[138]
The value our associated rules use by default to stop this RuleBook considering any further rules (when a Rule uses the stop macro). By default we use a value of true. [RULES EXTENSION]

Methods  

addToContents (ru)rules.t[33]

Add a rule to the contents of this rulebook [RULES EXTENSION]

follow ([args])rules.t[61]
Follow this Rule. This is the method game code will normally call to make use of this RuleBook. Each of our rules will be tested to see if it matches its conditions; we then run through those of our rules that match their rules in order of precedence until one returns a non-null value, which we then in turn return to our caller. If no rule returns a non-null value we return our own default value, which is normally nil.

This method can be called with as many arguments as the game code finds useful, or with none at all. Our arguments will then be passed on to each Rule that is called. The first argument will also be stored in our matchObj property, which our Rules can compare with their own matchObj condition to see if they match. This allows game code to, for example, run a RuleBook related to some object that isn't one of the objects directly involved in the current action. [RULES EXTENSION]

initBook ([args])rules.t[145]
Game code can use this method to initialize the values of custom RuleBook properties at the start of the processing of following a RuleBook. [RULES EXTENSION]

removeFromContents (ru)rules.t[39]
Remove a rule from the contents of this rulebook [RULES EXTENSION]

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