Hi,
I think I miss sth about the usage of script.
Let’s explain my expectations.
I would like to execute a script when i press on a push button to copy current value of some faders in other ones.
I created a script and a push button and set the same osc address. Moreover i bypassed the script osc to avoid sending message when a command is received from the button (i tried to put ‘>> scriptId’ in the linkId field of the button but the script was not executed).
With the dual osc address config it works but since the moment i pressed on the button, the script is called every time i change the origin fader value into the copy fader value…
I think it’s because i miss somethong about the comprehension of script
Here is the code of my script
JS{{
var fader = “preset_”+ @{parent.variables.n} + “"
+ @{parent.variables.p} + “fader” ;
var enable = "preset” + @{parent.variables.n} +
“_” + @{parent.variables.p} + “enable”;
var _fader = fader + 0;
var _enable = enable + 0;
var _speed = @{server_0_velocity_fader};
var _enabled = @{server_0_enable};
set(_fader, _speed);
set(_enable, _enabled);
_fader = fader + 1;
_enable = enable + 1;
_speed= @{server_1_velocity_fader};
_enabled = @{server_1_enable};
set(_fader, _speed);
set(_enable, _enabled);
_fader = fader + 2;
_enable = enable + 2;
_speed= @{server_2_velocity_fader};
_enabled = @{server_2_enable};
set(_fader, _speed);
set(_enable, _enabled);
_fader = fader + 3;
_enable = enable + 3;
_speed= @{server_3_velocity_fader};
_enabled = @{server_3_enable};
set(_fader, _speed);
set(_enable, _enabled);
}}
Note : this widget is cloned with different id (thks to variables.n and variable.p values) but i think it dosen’t matter but i mention it.
Morevore i meet some troubles to use a variable in a widget name, i would like to use a ‘for loop’ but i didn’t manage to interpret a variable in the container @{} what is the syntax for using variable inside it for exemple what would be the syntax if would like to use i variable in @{widget_i_exampe}.
Have a good day.