Toggle Button syntax

Is there a way to make a toggle button send 2 different commands, one upon activation, one upon release?
Can I add a $ variable within the address field with the toggle button? And if so, how would I define those variables?

You could define its address as follow:

#{
@{this} == 1 ? "/address_1" : "/address_2"
}

Or you could use a custom module to route your osc messages:

module.exports = {

    oscOutFilter:function(data){
        // Filter outgoing osc messages

        var {address, args, host, port} = data

        if (address === '/toggle_address') {
            address = args[0].value === 1 ? '/address_1' : '/address_2'
        }

        // return data if you want the message to be and sent
        return {address, args, host, port}
    }

}
1 Like

it’s working on toggle down, but does not send the message on toggle up.
I’m pretty new to scripting, is there something i’m missing?

Figured it out!
Turns out CasparCG needs >1 in the Data1 field of the message.
changing on=1 and off=2 worked
Edit: additionally, Prearg can be set to ‘1’ and values can be set to anything

Could you post a screenshot or be more precise for people to learn about your experience.

What is CasparCG ?

Cheers

Of course!

CasparCG is a graphics and video playout platform used by studios, TV stations, production houses, and VJs around the world for mediaplayout and broadcast computer graphics.
You’re able to load media files, PSD/flash/html templates, images, and more and have things played out over audio devices, SDI playout cards, and NDI.
You can learn more about it here https://casparcg.com/

I’ve attached a relevant screenshot that depicts how I set it up to play and stop a media file, using OSC Monitor to check and echo the message.

1 Like