eleazar wrote:
OK, when you get a chance, i'm apparently not guessing how to use "RootCandidate" properly.
Say there's an scope condition:
Code:
scope = WithinDistance distance = 5 condition = And [
Planet
OwnedBy TheEmpire RootCandidate.Owner
Construction low = 0 high = LocalCandidate.TargetConstruction / 2
]
Here there are two sets of objects being matched:
1) The objects actually being matched for the scope. These are objects within distance 5 of an object matched by the subcondition.
2) The objects matched by the subcondition, which are used to evaluate the outer condition. These are planets that are owned by the same empire that owns the object matched in the outer condition, and that have less than half their own target construction.
RootCandidate refers to the object being matched in the outer-most condition - WithinDistance in this case. This gives a way to refer to the object actually being matched by a big multi-part condition from one of the inner condition definitions, where the object being matched by a subcondition is likely not the same object being matched by the outer condition.
LocalCandidate refers to the object being matched in whatever condition it is directly in - the Construction meter condition in this case. This gives a way to refer to the object being matched by the current condition, regardless of what other conditions are matching outside or inside the current condition.
Also available is Target when writing an effect. For example
Code:
SetFarming Target.MaxFarming
Target only works within an effect, not within a scope or activation condition or building location condition, as those are not within an effect, so there is no "Target" object to refer to. Target is the object being acted on by an effect, be it meter-setting, moving, destroy, setting destination for a monster, etc.
And Source is also available. For example
Code:
SetFarming Source.Farming