Syntax to Change Dropdown/Switch via OSC/Scripting

How do you select a dropdown or switch item with OSC or scripting?

Here is an example value set that I need to be able to navigate:
{
"Subtle Tube": 0,
"Clean Tube": 0.04,
"Warm Tube": 0.07,
"Broken Tube": 0.11,
"Subtle Tape": 0.15,
"Clean Tape": 0.19,
"Warm Tape": 0.22,
"Old Tape": 0.26,
"American Tweed Amp": 0.3,
"American Plexi Amp": 0.33,
"British Rock Amp": 0.37,
"British Pop Amp": 0.41,
"Smooth Amp": 0.44,
"Crunchy Amp": 0.48,
"Lead Amp": 0.5,
"Screaming Amp": 0.56,
"Power Amp": 0.59,
"Subtle Saturation": 0.63,
"Gentle Saturation": 0.67,
"Heavy Saturation": 0.7,
"Subtle Transformer": 0.74,
"Gentle Transformer": 0.78,
"Warm Transformer": 0.81,
"Smudge": 0.85,
"Breakdown": 0.89,
"Foldback": 0.93,
"Rectify": 0.96,
"Destroy": 1
}

I noticed typing the value in the property box will select the correct entry, but sending this value to the widget either by OSC or scripting does not affect the widget. Also, sending an entire entry as a value does not work either (ie sending '"Rectify": 0.96')

Any guidance?

The value that should be sent is 0.96 but the problem here is the infamous float precision : when sending 0.96 as a float it actually translates to 0.9599999785423279, it's not a problem most of the time but in this particular case it is. To avoid that you'll need to send a double instead of a float (osc typetag "d"). The reason why it works when setting the dropdown value using a knob in o-s-c is that all numbers are doubles in the client and the conversion to floats only occurs when the osc message is sent.

This is very good to know! Thank you!

However, I'm still struggling to find a solution. I currently have a slider being controlled via OSC from GP. Inside this slider, I have:

OnValue
send('127.0.0.1:8080', '/Test', {type: "d", value})
send('127.0.0.1:9018', '/Test', {type: "d", value})
set("SliderValue", value)

When the fader is moved via the widget, there is a steady stream of doubles. However, when the slider is moved via OSC, there is no OSC output (9018 is WireShark). The same result when updating the value in the properties menu. The set("SliderValue", value) DOES work both with the widget and with OSC.

Is it possible to translate incoming OSC floats to outgoing OSC doubles without a custom module? Is this the best strategy?

Thanks again for all of your help and support

Ok, I found a really simple solution in retrospect. OSC float controls a variable. Variable has an if/else statement for each value range and outputs a hard-coded double. Thanks again for your help and patience!

if (value < 0.03) {
set('ChoirSaturnType3', 0)
}

else if (value < 0.07) {
set('ChoirSaturnType3', 0.04)
}

else if (value < 0.10) {
set('ChoirSaturnType3', 0.07)
} etc..

This is much simpler (sorry I didn't think of it in the first place):

set('ChoirSaturnType3', Math.round(value * 100) / 100)

Excellent! Thank you!