Two or more osc address on a toggle button

Solution 1: script widget

  • create a script widget
  • set its value property to @{toggle_id}
  • set its target property (if not using the server’s send option)
  • set its script property as follows:
JS{{

send(false, "/exec/2/1", value)
send(false, "/exec/3/1", value)

}}

The script will be executed when the toggle’s value changes;
Referece : https://openstagecontrol.ammd.net/docs/widgets-reference/#script


Solution 2: custom module

This solution works differently, the custom module filters outgoing and incoming osc message, there is no actual “binding” with the widgets but one can use conditions and functions to achieve pretty much anything. Here is a minimal custom module file that routes messages with address /toggle_1 to addresses /exec/2/1 and /exec/3/1.

module.exports = {

  oscOutFilter: function(data) {

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

    if (address == '/toggle_1') {

      // intercept messages from toggle_1 and send some messages

      send(host, port, '/exec/2/1', ...args)
      send(host, port, '/exec/3/1', ...args)

      return // bypass original osc message
    }

    return data

  }

}

You need to set at least one target for the widget or a global default target (server’s send option) to ensure it actually sends a message and gets filtered.

Reference: https://openstagecontrol.ammd.net/docs/custom-module/

1 Like