Thank you for all your responses =), especially ramones-- you look like you put a lot of effort into that answer. I'm glad to join such a helpful community.
I think I see the pattern now. I'd be grateful if anyone can confirm the truth about the following assumptions concerning the behavior of Construct 2 Events.
Quick definitions: "context of action" refers to left side of action statement; "instruction" refers to right side of action statement.
- The context of the action (e.g. "Ball") will reference all the instances filtered (or "picked") from the condition(s) of the event (generating a "selected object list"), or simply all existing instances of the object type if not referenced in the condition(s).
- An arrayMap of the instruction will be applied to the context.
- If the instruction references the context object (or more accurately the SOL for the context object type), then the properties (instance variables) for the instance of the object in the instruction will line up with each object in the SOL when the instruction is performed on each instance in the SOL.
- If the instruction references an object type that doesn't match up with the context, then the properties of that object will reference only the first object in the all-existing-objects list for that type, or SOL if that object type was referenced in the condition(s) of the event.
- For static classes like "Function" or "System" as the context, there is only one instance, so the instruction will only perform once no matter what, unless you use a foreach condition.
- If more than one object type is referenced in the conditions for the event, then a separate SOL will be generated for each object type.
- Using a foreach condition will override the default arrayMap behavior of the context object. See image below:
Note that the ball action would ordinarily arrayMap the instruction (or create a for each in this code translation), but here if we add a foreach condition, it overrides that and instead the context becomes just the current instance of the context object in the outer foreach loop.
Is this all correct?
If it is, then I hope that other people in the future see this thread, because I had trouble finding these clarifications elsewhere. The foreach and SOL part of the manual is a bit scant, but I guess I understand, since it's probably a bit advanced for the target user of the tools.
Thanks again!CannedEssence2013-05-22 06:17:25