stupid save value.x question
stupid save value.x question
hi all
im newbee in scriping and programming. think its a very simple problem and hope someon can help me!
i want to control fadervalue with a button. therefor i used a switch. when switch is on fader value should be 0. when switch is of fader value should be at the last value. hope you anderstand what i want to do?
therefor i creat the following script. on is switch object. value is a normal fader:
decl temp;
if (on.x==1)
{
temp=value.x;
value.x=0;
}
else if (on.x==0)
{
value.x=temp;
}
in my oppinion it should be work? but it seems the value cant be saved by the temp variable?
maybe someone has also a quick solution to use same for a multislider. to turn off every slider seperat with a special switch. think therefor i must
use vectors.
greetings
vmy
im newbee in scriping and programming. think its a very simple problem and hope someon can help me!
i want to control fadervalue with a button. therefor i used a switch. when switch is on fader value should be 0. when switch is of fader value should be at the last value. hope you anderstand what i want to do?
therefor i creat the following script. on is switch object. value is a normal fader:
decl temp;
if (on.x==1)
{
temp=value.x;
value.x=0;
}
else if (on.x==0)
{
value.x=temp;
}
in my oppinion it should be work? but it seems the value cant be saved by the temp variable?
maybe someone has also a quick solution to use same for a multislider. to turn off every slider seperat with a special switch. think therefor i must
use vectors.
greetings
vmy
Re: stupid save value.x question
I guess it doesn't work because the variable is inside the script. Creating a variable (expression) and include it in the script should solve the problem.
Formant+Eurorack, PPG wave 2.2, Korg MS-20, etc., EWI 4000s, QuNeo, etc., Mixbus32c, u-he, MadronaLabs, Samplemodeling, NI, etc., iPad2/4/Pro
Re: stupid save value.x question
Create a new empty expression (x= button in desktop editor) inside your fader - call it lastX (for example).
Create a script in your fader - lets name the script setLastX.
Set this script to execute on expression z, and then use the dropdown menu at the far right of the scripting window to execute when z drops to zero (arrow pointing down).
Inside the script type:
lastX = x;
This script will be saving the fader's value as lastX everytime z drops to zero - in other words everytime you stop touching the fader, in other words every last value as you want. (Assuming physics are off for the fader)
Now, inside your button type this script
If (x==1) {value.x = value.lastX;} else {value.x = 0;}
Create a script in your fader - lets name the script setLastX.
Set this script to execute on expression z, and then use the dropdown menu at the far right of the scripting window to execute when z drops to zero (arrow pointing down).
Inside the script type:
lastX = x;
This script will be saving the fader's value as lastX everytime z drops to zero - in other words everytime you stop touching the fader, in other words every last value as you want. (Assuming physics are off for the fader)
Now, inside your button type this script
If (x==1) {value.x = value.lastX;} else {value.x = 0;}
Re: stupid save value.x question
very nice!!
it runs....
thanks alot.
now i will test this templet to use it with 10 faders in multislider and 10 button.
hope i now can solve this problem....
greetings
vmy
it runs....
thanks alot.
now i will test this templet to use it with 10 faders in multislider and 10 button.
hope i now can solve this problem....
greetings
vmy
- Attachments
-
- save.jzml
- savebutton
- (4.05 KiB) Downloaded 54 times
Re: stupid save value.x question
just have modified the templet to use also multislider by painting over switchs and it runs very well!!!!
think its a very stupid solution. think i also can use variable for vectors in multislider, but i only need 10 and for this its running well.....
greetings and thanks alot for your help !!
vmy
think its a very stupid solution. think i also can use variable for vectors in multislider, but i only need 10 and for this its running well.....
greetings and thanks alot for your help !!
vmy
Re: stupid save value.x question
There's a simpler way to achieve what you achieved in "save2" with the use of vectors and a loop.....
Yet though, it still isnt "right" - both my example attached above and yor version....Draw some values on the sliders, switch on button 1 and ALL the sliders go to zero not only the first one....Thats not what we hoped for, was it?
Here is the correct functionality!
Yet though, it still isnt "right" - both my example attached above and yor version....Draw some values on the sliders, switch on button 1 and ALL the sliders go to zero not only the first one....Thats not what we hoped for, was it?
Here is the correct functionality!
Re: stupid save value.x question
yes!! great! i understand. but i wasnt able to get this nice solution.
only one thing i missed. maybe you also have a solution for this problem? but its only a blemish.
when buttons are of i can change the value of the fader. to save the value i must put the button on and of. maybe there can be a solution that i cant change the faders value when the corresponding button is off? hope you understand?
thanks for this very nice templet. i have saved it as modul to use it also in other templets!!!
greetings
vmy
only one thing i missed. maybe you also have a solution for this problem? but its only a blemish.
when buttons are of i can change the value of the fader. to save the value i must put the button on and of. maybe there can be a solution that i cant change the faders value when the corresponding button is off? hope you understand?
thanks for this very nice templet. i have saved it as modul to use it also in other templets!!!
greetings
vmy
Re: stupid save value.x question
I think you would be better off by using two buttons - one to reset the fader to zero (as now our buttons does when it's turned to off) which would be a "push button" not a switch (in Lemur terminology, a "pad") and one to save the fader position as a "preset". There is a very nice tutorial hanging around somewhere in the forums about saving "presets" - this would allow you to "recall" not one, but all faders into their position with the push of a button and have not one but many "presets" available. Let me know if you need an example to get you started!
Re: stupid save value.x question
here's the dual buttons approach actually - no preset saving needed - I think it is much more clear and intuitive than our previous efforts! And its better code-wise!
- Attachments
-
- save4.jzml
- (12.2 KiB) Downloaded 75 times
Re: stupid save value.x question
wowowowo
softcore your the greatest!!! just have tested your solution. runs very well.
i must learn very much to understand your code..... uuuuuhps.
thanks alot! i worked with a kyma and therefor its fantastic to programm special controllers. lemur is an fantastic tool for this kind of work.
greetings
vmy
softcore your the greatest!!! just have tested your solution. runs very well.
i must learn very much to understand your code..... uuuuuhps.
thanks alot! i worked with a kyma and therefor its fantastic to programm special controllers. lemur is an fantastic tool for this kind of work.
greetings
vmy