Using an event listener on a Widgets Script property

Hi , so I need to do some actions in which I use the "Script" Property , so far so good. But now I need retrieve the status of the OSC Message that has last came in for the corresponding widget, store it in a variable in the Script property , and trigger some code depending on that value that has been listened

So simplifying I've got the following widget with some code to be executed upon been triggered (Using the script property)

"type": "button",
"id": "trackControl01",
(...)
"script": "
// SOME CODE TO BE EXECUTED
 ",
(...)

But in this case I need to check what is the last value of the OSC Message associated to the Widget (OSC{/note} in my case as it is a velocity message) . And upon the button been triggered , execute some
code or other code

"script": "
if (OSC{/note} == 47 ) {
// SOME CODE TO BE EXECUTED
} else {
// SOME OTHER CODE TO BE EXECUTED
}
 ",

As far as I can see the script property of a widget doesn't have any listener of some sort.
scripting

Is there a way to achieve this functionality?

Thank you again !!

You can use a variable widget to receive these note messages instead of an OSC{} block, you'll be able to read its value in scripts using get.

1 Like