[Help Needed] Video chooser menu issue with switch and null operators

I’m running into an issue with my switch and null operators. I’m trying to create a video chooser menu where users choose a video to watch using a key press, and I’m working on having it so that when the chosen video ends, it automatically returns to the menu screen so users can watch another video.

I have it working to where it displays the menu screen immediately after the last frame of the video plays, however, when this happens, it severs the connection between my switch and null operators. Meaning that it’s impossible for the user to continue viewing the rest of the videos.

This is the code that I have in my CHOP Execute DAT to achieve this:

def offToOn(channel, sampleIndex, val, prev):
	if val == 1:
		op('switch1').par.index = 0

Is there any way for me to keep the switch and null operators connected once this runs, or is there another way to achieving this goal altogether? Thanks.


Picture of set-up attached.

Hi,

It’s difficult to debug this using just the image, but here’s a couple ideas:

  1. It looks like your chopexec1 DAT is reading data from the merge CHOP that has data for all of your videos. Without knowing if you’re doing any sort of masking to filter out irrelevant channel data.
  2. There are alerts on all your video player TOPs, can you tell us what they say?
  3. can you share your TOE?

Hi, thanks for your response.

That is true, I have the chopexec1 DAT connected to the merge CHOP (I have it checking last_frame within each info CHOP)

The alert for the videos just tells me that the resolution is limited due to having a non-commercial key.

I can share my file now:
MEMORY_FORGE_INPROGRESS.toe (5.4 KB)

Hi,

I see, so you’re using an expression to get the current value of null1 into the switch index, but then overwriting it with a constant when your chopexec runs.

The issue is that the expression is cleared by your chopexec. The easiest way to fix this without reworking the whole setup would be to create another chopexec and bind it to your null1. Then have that set the op('switch1').par.index value the same way as the other chop exec.

Thanks for responding,

Is this what you were talking about? (I duplicated the chopexec and connected it to null1), sadly for some reason it still severs the connection between null1 and switch1 after the first video plays.

Here’s image for reference:

Hi,

You’d want to set up a new chopexec and use the onValueChange function. Like so:

I’ll attach an example.
MEMORY_FORGE_INPROGRESS_fm.toe (5.5 KB)

The connection line will break, because you’re changing the mode of the parameter from using the expression to using a constant value that’s assigned with the python script.

Here’s a link to the doc page about parameter modes:
Parameter Modes

That was very helpful, thank you. It makes a lot more sense now. :slight_smile: