Count the number of instances by their variables?

I have a lot of instances of the same object. Each one has the object variables Active and Style. The objects become Active=1 when they are clicked. Let’s say 3 of the instances have
How do I create a condition that checks whether the number of instances with style=yellow and active=1 is exactly 3?
Also, how do I “pick” only those instances so that any following actions only apply to those 3 instances?

1 Like

Create a variable and add 1 to it for each instance that meets the conditions, then check if the value of the variable = 3.

When you need to apply an event to several instances, you usually need a for each event.

Right, I got myself in a knot and it seems so simple now you say it! Thanks I’ll try it later :smiley: