Using "inverted" from the scripting API

Hello everyone,

I’m trying to implement a Java script that creates a nested event that must be played only when a labelled parameter P “is NOT equal” to a specific value V. The code is like this:

var second = secondTrack.addSound(evt.timeline, “EventSound”, startTime, 1.0);
second.addParameterCondition(studio.project.lookup(“parameter:/P”), … )

But I don’t know how to set the condition to “is NOT equal” to a given value V, i.e., to set the corresponding “Inverted” flag appearing in the event editor. As an alternative way I also tried to write the condition as “P equals to all the rest” of possible values, but I neither can use the “OR” operator from the script.

Is there any possible way to do this?

Thank you in advance!!

Hi,

Thank you for sharing the code!

Yes, this is possible. The object returned by addParameterCondition() exposes an isInverted property, which corresponds to the “Inverted” flag appearing in the event editor.

For example:

var condition = second.addParameterCondition(studio.project.lookup(“parameter:/P”), … )

condition.isInverted = true

Hope this helps! Let me know if it works.

It works!! Thank you so much.

Is this documented somewhere?

Glad to hear that works!

At the moment, this isn’t explicitly documented in the scripting API reference.

While addParameterCondition() is documented, properties like isInverted aren’t currently listed in detail, so the best way to discover them is by inspecting the returned object in the console using dump().

This also helps me. Thank you!