Resend another widget’s current value

I am trying to achieve this:
Whenever I tap on a Switch widget "lookSwitchA" or "lookSwitchB" I would like another Switch widget "colourPaletteSwitch" to send it's current value.

I tried to set it up with the master / slave via linkId but what happens is that if I change value on "LookSwitchA" to for example "2" it changes the value on "colourPaletteSwitch" to value 2 as well. I would like the value on "colourPaletteSwitch" remain the same and just retrigger sending it's current value.
A help would be much appreciated!!

I attached the file if that helps.

RS013-MS_COLLINS_Controls-01.json (46.7 KB)

Try this in the onValue property of lookSwitchA / lookSwitchB:

set('colourPaletteSwitch', get('colourPaletteSwitch'))

Awesome thank you! This works but after testing it I realized that there needs to be a couple of ms time delay between the OSC messages. It there a way to add a specific time delay to it?

setTimeout(()=>{
  set('colourPaletteSwitch', get('colourPaletteSwitch'))
}, 1) // 1 ms

Thank you so much!!!!

Is it possible to expand this functionality to re-send the value of all widgets in the session without manually inputting the ID of every single widget?

One the following:

  • Click on "Menu > State > Send"
  • Run toolbar(1,2)
  • Run stateSet(stateGet('root'))

So the 3rd option means that if I add OnValue property " stateSet(stateGet('root')) " to a widget it will re-send value of every other widget in the session?

Yes, provided the widget is interacted with. Also its own value will be resent as well.