Translate OSC Message

EDIT: Switch Button OSC Address follow up

Hi
I am looking for a way to translate OSC Messages to a form that another software can process.
Eg I have a three way switch which outputs the OSC address and then appends either 1, 2 or 3.

The problem is that QLAB doesn’t recognise the appended value.

Im guessing I need a custom module to translate.

eg
If Address = Switch And Value = 1 Then Send “Cue1/start”
If Address = Switch And Value = 2 Then Send “Cue2/start”
etc

I have no idea how to script this
Can anyone help

You can omit the args in the send function to send an osc message with no value:

module.exports = {

  oscOutFilter: function(data) {

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

    if (address == '/cue/Switch/start') {

      // use the switch's value to construct the address and send a message with no value
      send(host, port, '/cue/Switch' + args[0].value + '/start')

      // bypass the original message
      return
      
    }

    return data

  }

}