How to disable a top when a CHOP value = 0?

How can I disable a top when a specific CHOP value = 0?

I’m thinking that there is a way to do this with python to keep things neat.

I am using tx ty hand data from a kinect to control position of circles for multiple players at once, but when the player id=0 when there is no player, I want the circle TOP to be disabled so there is no circle just sitting there in the middle when no player is present.

Maybe something like this:

if 'value' = 0:
    op(p1_hand_l).par.enable = 1
else:
    op(p1_hand_l).par.enable = 0

How would I use this, and how do I reference the specific CHOP channel where ‘value’ is?

Hello,
In python, to compare value its “==” not “=”
But you can also use logic Chop to obtain 0 or 1 when a value cross a limit.
Normaly, with Top, you would prefere put the opacity at 0, enabling the Top (namely cooking/uncooking) can have some unexpected effects, as changing the resolution of composition.
The Python would be:

if value == 0:
   op('myTop').par.opacity = 0
else:
   op('myTop').par.opacity = 1

math.ceil (ie: ceiling) returns a 1 for any value between 0 and 1, and a zero when it’s actually zero.

if you need to clamp the value to avoid setting opacities higher than 1, use:

min( math.ceil( op('opName')['channelName'] ), 1 )

edit: sorry the minimum function is just ‘min’ not ‘math.min’