I can think of 2 ways to do it.
If you know the exact number of child and it is always the same, all you need to do is use the compare the value of an object variable condition like so:
Variable carPart.1.m of car = 0
Variable carPart.2.m of car = 0
If you don’t know the number of child because it is different depends on the car type or something, the first thing we need is the Repeat event to repeat certain event as many times as many child you want to test. So wee need to use the Repeat event. Then, we need to know how many child the carPart variable has and we need to use an expression to get the number of child of carPart:
car.VariableChildCount(carPart)
“car” is the object and the rest is an expression to get the child count of the object variable called “carPart”. It is going to return the number of child this variable directly has but not the sub-child like m and others. So in case there is 2 child, it is going to return 2 and the event looks like this:
Repeat car.VariableChildCount(carPart) times:
condition : action
So we repeat the events as many times as many child the carPart variable has. But we need to know exactly if it is child 1 or child 2 or which. So we need to know if it was the first time the Repeat event fired or the second or what. I don’t think there is any built-in way to do it. So we need a counter variable to count manually.
Initialize a variable called counter with the value 1 at the beginning of the scene or whenever you want to compare the childs.
At the beginning of the scene : Do = 1 to scene variable counter
Then, we are going to use this value inside an expression to pick the specific child of carPart and pick the “m” child of that child
Variable carPart[ToString(Variable(counter))][“m”]
Then we are using this expression inside the Repeat event to compare the m value of each child of carPart if the value is = 0 or not
Repeat car.VariableChildCount(carPart) times:
Variable carPart[ToString(Variable(counter))][“m”] of car = 0 : action
replace “action” with anything you want to do if value of “m” is = 0
But, you want to put this as a sub event of the Repeat event, so leave the Repeat event blank and use a sub-event to compare the value of “m”
Repeat car.VariableChildCount(carPart) times:
no condition : action
sub-event: Variable carPart[ToString(Variable(counter))][“m”] of car = 0 : action
The last thing is to add one more sub-event and increase the value of the counter by 1
Repeat car.VariableChildCount(carPart) times:
no condition : action
sub-event: Variable carPart[ToString(Variable(counter))][“m”] of car = 0 : action
sub-event: no condition : Do + 1 to scene variable counter
The reason you want to use sub-event is the counter variable because you want to increase the value of the variable in the loop even if the value of m is > or < 0.
And that’s it. You fire the loop, it is going to repeat the events as many times as many child carPart variable of the car objects has and compare the “m” value of each child.
If you are familiar with the loops, expressions, it might seem confusing at first but not that difficult really.
Let me know if something is not clear