Change Toggle State Works on Some Buttons but not Others

I have successfully changed the toggle state of buttons by using the following script:
if (value ===1){
set ('legato',0)
set ('spiccato',0)
set ('staccato',0)
set ('marcato',0)
set ('tremolo',0)
set ('sustains_mute',0)
set ('legato_mute',0)
set ('spiccato_mute',0)
set ('spiccato_tap',0)
set ('pizzicato',0)
set ('bartok',0)
send('midi:OSC','/program',1,1)
}
So when I press the sustains button, for example, it lights up, and the legato button (or whichever button is currently lit) goes dark. It works beautifully.

But here's the problem. I tried doing the same with my transport buttons and got strange behavior.

Record
Play
Pause
Stop

I used the same script, but modified send to /control as follows (this one for the 'record' button):

if (value ===1){
set ('play',0)
set ('pause',0)
set ('stop',0)
send('midi:OSC','/control',16,1')
}

Unfortunately, this gets no response from my DAW. If I put the "send" command values in the OSC section, the DAW responds, but the buttons sometimes send out the wrong CC values.

Basically what I'm trying to do is get Record to light up when I'm recording, play to light up when I'm running playback, while the others go dark. I'm not sure why it works for the first set of buttons using the /program command, but not with the second set using the /control command.

Hopefully this all makes sense.

there's a quote character at the end that shouldn't be here. You should see an error in the console (ctrl+k)

Thank you. But unfortunately, the send command, even though set to 16,1, for some reason sends 16,4 to my DAW. So when I press stop, it sends the record command. ??

Can you enable the server's debug option and check in the launcher's console what's being sent by o-s-c ?
Also there should be 3 arguments after /control (channel, cc, value).

Okay. Thank you. I've got it working now. What I found was a combination of things. First, I needed that third argument. Also, I needed to put the send command OUTSIDE of the brackets, like so:

if (value == 1){
set ('record',0)
set ('pause',0)
set ('stop',0)
}
send('midi:OSC','/control',16,2,50)

I'm unclear what the value argument needs to be. I randomly chose 50 and it works. What should I be putting here?

I'm unclear what the value argument needs to be. I randomly chose 50 and it works

Control change events have a value between 0 and 127 (like velocity for notes), what you should put here depends on the DAW.

Makes sense. Thank you for your help.