Example capx
AS you can see, I used the expression "Count" that counts the number of instances of an object on screen.
In events, you can associate several conditions (right click, add another condition)
Also the order in which the conditions are placed matters. At first, I had "Trigger once while true" as the first condition, and it did not work. Placing it as a second event works as intended.
This example might not apply totally to what you're doing. But I guess it is a good base, and with a few tweaking/adaptation it will fit right in.
And nothing prevents you from comparing a variable rather than an expression.