Set Custom Variable using Custom Module

Im pretty sure I understand the custom variable's usage within OSC.

Currently I have a variable widget with this in its onCreate:

setVar("this", "test", 0);

And other widgets access that with this in their onValue:

let number = getVar("widgetID", "test");

and im doing other things outside of that ofc but that's the basics for access the variables within OSC as I understand. Regarding the custom module, I assume using the send() command is correct but im not sure how to access and set the custom variable this way.

Seems that I should use /EDIT or /SET, but im not entirely sure what to use after that.

Figured it out looking at other users posts.

receive('/SCRIPT', 'setVar("id", "variable", value)');
1 Like

though, now im having an issue with sending values from the custom module with variables. It seems string interpolation doesnt work using ${} inside a string of the custom module.

EDIT:

Of which i didnt realize you had to wrap the /SCRIPT section with backticks instead of single quotes.

which looks like this

receive('/SCRIPT', `setVar("id", "variable", value)`);
1 Like