Closed japalie closed 1 year ago
I found a solution, it is not nice but it works. Maybe someone has a better idea how to solve it:
function init() { script.log("Init Script, resetting values");
var v = local.values;
var json = v.getJSONData();
var jsonData = JSON.stringify(json);
jsonData = JSON.parse(jsonData);
var ArrayData = jsonData['parameters'];
//script.log(jsonData['parameters']);
//script.log(jsonData['parameters'][0]);
//script.log(jsonData['parameters'].length);
for (var i = 0; i < ArrayData.length; i++)
{
//script.log(i);
//script.log(ArrayData[i].niceName);
v[ArrayData[i].niceName].set(-1);
}
}
Hello, the script engine inside Chataigne is not full fledged, so a lot of things are not available. You can check in the doc to see what's available. V8 support is on the roadmap but lacking time and resources to do it. Any help is welcome !
With that in mind, your solution is as good as it can :)
Dear community
I have a issue with my script. I want to reset all Values wich will automatically created by a incoming OSC event by initialisation of the software. So I thought it is very easy, write a little script wich will ForEach through the local.values Container and set the Values to -1. 8 lines of Code, very easy :) But it will not work because i cannot forEach on the local.values variable.
Is there another way how i can loop through the variable? I tried also to convert the container to a array but it wont work.
thank you for your help.
function init() { script.log("Init Script"); var v = local.values; foreach(val in v) { v[val.name].set(-1); } }