PreConditionclass | precond.t[20]

A PreCondition encapsulate a condition that must be fulfilled in order for an action to be fulfilled (e.g. a container must be open before we can put anything in it). A PreCondition may also try to bring about the fulfilment of the condition it enforces via an implicit action.

`class PreCondition : object`

Superclass Tree (in declaration order)

`PreCondition`
`object`

Subclass Tree

`PreCondition`
`ObjectPreCondition`

Global Objects

`actorInStagingLocation actorOutOfNested containerOpen objAudible objClosed objDetached objHeld objNotWorn objOpen objSmellable objUnlocked objVisible touchObj travelPermitted`

Summary of Properties

`preCondOrder`

Summary of Methods

`checkPreCondition verifyPreCondition`

Properties

`preCondOrder` | `precond.t[64]`

Precondition execution order. When we execute preconditions for a given action, we'll sort the list of all applicable preconditions in ascending execution order.

For the most part, the relative order of two preconditions is arbitrary. In some unusual cases, though, the order is important, such as when applying one precondition can destroy the conditions that the other would try to create but not vice versa. When the order doesn't matter, this can be left at the default setting.

Methods

`checkPreCondition (obj, allowImplicit)` | `precond.t[33]`

Check the condition on the given object (which may be nil, if this condition doesn't apply specifically to one of the objects in the command). If it is possible to meet the condition with an implicit command, and allowImplicit is true, try to execute the command. If the condition cannot be met, report a failure and return nil to terminate the command.

If allowImplicit is nil, an implicit command may not be attempted. In this case, if the condition is not met, we must simply report a failure return nil to terminate the command.

`verifyPreCondition (obj)` | `precond.t[51]`

Verify the condition. This is called during the object verification step so that the pre-condition can add verifications of its own. This can be used, for example, to add likelihood to objects that already meet the condition. Note that it is generally not desirable to report illogical for conditions that checkPreCondition() enforces, because doing so will prevent checkPreCondition() from ever being reached and thus will prevent checkPreCondition() from attempting to carry out implicit actions to meet the condition.

'obj' is the object being checked. Note that because this is called during verification, the explicitly passed-in object must be used in the check rather than the current object in the global current action.

Adv3Lite Library Reference Manual
Generated on 15/03/2023 from adv3Lite version 1.6.1