XY Pad Scripting

Does anyone know what is wrong here? I'm trying to set the CC# of the XY pad from a variable on another widget.

var x = value[0]
var y = value[1]
send('midi:OSCMIDI', '/control', getVar("send_value_x1", "ccNum"), x)
send('midi:OSCMIDI', '/control', getVar("send_value_y1", "ccNum"), y)

Says wrong number of arguments, but everything else I've tried isn't working properly.



How did you implement the VAR{} block in the send_value_x1 and send_value_y1?

I did a quick test here with dummy variables using VAR{} and it works with no errors.

/control needs 3 arguments (channel, cc number and value), only 2 are provided in your code. You can call console.log(getVar("send_value_x1", "ccNum")) to check what's actually returned by getVar in case there a problem there too.

Thank you! Yes, I needed a "1," after /control,

Really appreciate the help.

I have one other question regarding these XY pads. If I turn doubletap on, how do I set default position values for both x and y as I do not want them both to be 0 when they are reset.


It's interesting that I don't get any error if I don't add last value argument, and it sends 0 by default. (debug is off though) EDIT: with debug on it shows the missing argument message.

You can use array notation [ 64, 64 ] in the default prop of the XY widget.

Thank you so much.

Yeah, it didn't give an error, just didn't work right and the argument shows when you have debug on.

Keep coming across more things with the xy pad. What if I wanted the behavior of the dot in the XY pad to jump when I press an area that's not directly on the dot in the xy pad.

For example, if the dot is in the top left corner, how can I make it so when I click on the bottom center or anywhere else on the xy pad the dot then jumps to that position.

Is there a simple way to achieve this?

EDIT: Just found out. Turn Snap on in xy settings.

Just set the snap prop (in the xy tab in the inspector) to true. The circle now jumps to where it's touched/clicked.

Appreciate all the help guys. Learning a lot and made great progress with these XY pads.

1 Like