Is it possible to create a script that changes the value of a certain global variable, lets say 'plum' such that whenever the crossfader is below 50%, 'plum' will take a value of 1 and otherwise it will take a value of 2? Thank you
Posté Thu 18 Oct 18 @ 2:26 pm
It depends on where/how this script is called.
You can remap your controller's crossfader to:
crossfader & param_smaller 50% set '$My_Global_Var' 1 : set '$My_Global_Var' 2
However this script will work only when you move the crossfader from your controller. It won't work if you move it on the skin.
You will have to modify the crossfader of the skin to use the same script if you want it to work from there as well.
Still the script won't work if the crossfader moves by the software itself (e.g. when you mix videos and you have the crossfader set to automatic)
Generally it would be better to query the crossfader itself when you are about to use it.
In other words instead of setting a variable and checking the variable elsewhere, you should check the crossfader itself at the same location you were about to check the variable.
You can remap your controller's crossfader to:
crossfader & param_smaller 50% set '$My_Global_Var' 1 : set '$My_Global_Var' 2
However this script will work only when you move the crossfader from your controller. It won't work if you move it on the skin.
You will have to modify the crossfader of the skin to use the same script if you want it to work from there as well.
Still the script won't work if the crossfader moves by the software itself (e.g. when you mix videos and you have the crossfader set to automatic)
Generally it would be better to query the crossfader itself when you are about to use it.
In other words instead of setting a variable and checking the variable elsewhere, you should check the crossfader itself at the same location you were about to check the variable.
Posté Fri 19 Oct 18 @ 11:03 am
Thank you very much PhantomDeejay. I will test it on the controller soon.
Would there be a way to make the script work as well with the automatic crossfader or on the skin?
Would there be a way to make the script work as well with the automatic crossfader or on the skin?
Posté Fri 19 Oct 18 @ 1:55 pm
The script turns off automatically if the crossfader changes above 50% and then it doesnt change the value of the global variable anymore :/
Posté Sat 20 Oct 18 @ 12:13 pm
misses a question mark
crossfader & param_smaller 50% ? set '$My_Global_Var' 1 : set '$My_Global_Var' 2
crossfader & param_smaller 50% ? set '$My_Global_Var' 1 : set '$My_Global_Var' 2
Posté Sat 20 Oct 18 @ 2:10 pm
I had already included the question mark, however thank you for the addition! The problem persists though.
Posté Sat 20 Oct 18 @ 4:28 pm
Script looks fine to me, unless there is something else we miss.
How can you tell the value of the variable ?
Can you copy-paste all the actions/code you are using ? Is this for a controller, a skin you are using with some special functionality that would help to share more info about it. ?
How can you tell the value of the variable ?
Can you copy-paste all the actions/code you are using ? Is this for a controller, a skin you are using with some special functionality that would help to share more info about it. ?
Posté Sat 20 Oct 18 @ 11:16 pm
So I have customized one of the buttons of my pioneer ddj sb to follow this exact script:
crossfader & param_smaller 50% ? set '$var_x' 1 : set '$var_x' 2
When I click the button, it changes the variable x value to 1 if the crossfader is indeed below 50%, however if I move the crossfader to over 50%, it then turns of the script. If I reactivate the script while the crossfader is over 50%, it then indeed does change the variable x to value 2. However I do not want to turn the script on the whole time as it ruins the idea of automation which I want to achieve. I use the var_list command to see the value of the variables.
Could there be issues with my license? I am in the trial period for the controller, and the home version, which perhaps has some more restrictions regarding the use of scripts.
crossfader & param_smaller 50% ? set '$var_x' 1 : set '$var_x' 2
When I click the button, it changes the variable x value to 1 if the crossfader is indeed below 50%, however if I move the crossfader to over 50%, it then turns of the script. If I reactivate the script while the crossfader is over 50%, it then indeed does change the variable x to value 2. However I do not want to turn the script on the whole time as it ruins the idea of automation which I want to achieve. I use the var_list command to see the value of the variables.
Could there be issues with my license? I am in the trial period for the controller, and the home version, which perhaps has some more restrictions regarding the use of scripts.
Posté Sun 21 Oct 18 @ 11:47 am
No, its the crossfader on your controller that needs to be mapped like the above.
A button mapped as above, will execute the crossfader action , it will not query it.
Alternatively, yuo could store the crossfader position to a variable and query the variable, but this will require the button to be pressed in order toread the position and update the variable...something like.
A button mapped as above, will execute the crossfader action , it will not query it.
Alternatively, yuo could store the crossfader position to a variable and query the variable, but this will require the button to be pressed in order toread the position and update the variable...something like.
set '$var' '`crossfader' & var_greater 0.5 ? set '$someothervar' 1 : set '$someothervar' 0
Posté Sun 21 Oct 18 @ 2:00 pm