Condition: waiting for an empty container

Hi, I’m trying to wait for a container to be empty before following the program, for which I tried the next condition:

condition (lambda: len(container.Components) == 0)

I haven’t managed to make this work so far, I would appreciate any clue in how it can be done

Hi,

You might be missing a trigger. Condition is evaluated once when code execution gets to that line but after that it is evaluated only when a trigger event appears. Typically trigger is a signal on that component that is connected to the script and when signal value changes (or same value is signaled again) it gives a trigger for the script. Fix in this case could be to create a boolean signal and assign it as TransitionSignal on your container. Then on signal’s properties add connection to your script.

-k

It worked exactly as you recommended, in case anybody else needs to apply it. Thank you very much