[RESOLVED] Change Select TOP par with CHOP value

I’m trying to figure out how to increment the Select TOP’s top par based on my Touch OSC CHOP’s value. Switching between each Base based on the value the CHOP is outputting. So if I have 4 buttons toggled in Touch OSC, then the 4th Base COMP would be selected and so on.
Ex: top par would be: ‘Abase4/outNULL’ if the 4th button is pressed.
I am pretty new to Touchdesigner and this may be super simple but I am incredibly lost.

This is my current setup, I have some code written based on Matthew Ragan’s simple VJ setup, but I want to modify the code to work with Touch OSC instead of the TD interface. I am not shy to use code to make this work.

Since you are pointing to the ADeckNULL CHOP, I would replace your Panel Execute DAT with a CHOP Execute DAT instead and monitor the CHOP directly.

Then in your callback script, you’d also need to change your paths to point directly to the CHOP instead of …/ADeckNULL. Then it should work as you have it setup basically.

1 Like

Hey Ben,

Thank you for the quick response.

Either I don’t completely understand, or I’m missing something, but I tried just replacing the Panel Exec DAT with a CHOP Exec DAT and I can’t seem to rewrite the TOP par in the select chop.

Here’s the code, I noticed that the CHOP Exec is asking for more parameters, how do I incorporate those? Or do I even need to?

Can’t see the errors by just looking at the code, could you include your toe file?

1 Like

Unfortunately, I am a “new user” so I can’t provide a file over the forums.
Is there any other way I could possibly get this file to you? Or is there a way to check errors directly?

Thank you

You have leveled up from “new user” :raised_hands: , can you try again?

1 Like

Perfect! Thank you!

Here’s the file, it might be a bit messy.

The system is in /project1/ADeckSelect/>>

set_02.31.toe (37.8 KB)

Okay, it was very close. First thing I noticed when opening in 2020.24520 us that the CHOP Execute DAT’s ‘CHOP’ parameter was not set to look at the CHOP you wanted to monitor. So I set it’s CHOP parameter to ‘ADeckNULL’ so it monitors that CHOP.

Then when triggering changes I noticed the results were “Abase1.0/outNULL” or “Abase2.0/outNULL” etc. This is because CHOP values are floats by default, so to get an integer from them you need to cast to an integer using int().
Changing this line to:
target = 'Abase' + str(int(AVal)) + '/outNULL'
does the trick.

This file should be working now.set_02.32.toe (38.2 KB)

1 Like

Works perfectly! Love this solution.

Thank you so much, the community here is the most helpful I’ve seen.

:metal: