Referencing an OSC value in a script

Hi there,

I hope you can help! I have a bit of script that is doing what I want (effectively to only display the text after the second ":" in it (bit of a fringe need, but Kore 2 sends its text parameters as "Dr-I:UsP1:BDAttc" and I only need the "BDAttc" part of that string.

So I have a script onCreate that goes:

// function you can use:
function getSecondPart(str) {
return str.split(':')[2];
}
// use the function:

var slotValue = getProp('variable_1','value')

setVar("text_3", 'Lbl', getSecondPart(slotValue) )

And this will correctly return for example "toast", where the value of 'variable_1" is "ham : cheese : toast".

The issue I have is that is I change that variable's value to OSC{/Knob1/Name2} to capture the full string, my script returns then "undefined". Basically, I need a way of capturing the string of the OSC message so that it can be referenced in script. I am sure this should be easy enough, but so far all my efforts have failed! :smile:

Any help would be massively appreciated thanks!

Actually, this is just me being stupid, it actually does work! Just had to change the script from OnCreate to OnValue and trigger it with an event to get the text to update thanks! :smile: