Greetings,
Having issue with combining two scripts that are working.
Script 1 works. It's starts a timer and continuously checks if elapsed time is greater than a variable set with a custom knob. If so, it stops the track.
Script 2 works. It starts a timer for a set time (10s for testing) and fades the track after the elapsed time, subsequently stopping it and returning the fader to 100%.
What I'd like is a version of script 2, that uses a variable for the wait time rather than a set time. I tried just plugging in the variable in the original script but that didn't work:
When that didn't work, I tried combining the two scripts, and that didn't work either. Not sure why, but rather than running the sweep, it just immediately stops.
Broken down, here's what it should look like
Thanks in advance for any help!
Having issue with combining two scripts that are working.
Script 1 works. It's starts a timer and continuously checks if elapsed time is greater than a variable set with a custom knob. If so, it stops the track.
play & repeat_start_instant "myTimer" 1000ms 121 & get_var '@$deck1_fadeout' & param_greater 'get_time elapsed 1000' ? nothing : repeat_stop "myTimer" & stop & stop
Script 2 works. It starts a timer for a set time (10s for testing) and fades the track after the elapsed time, subsequently stopping it and returning the fader to 100%.
play & repeat_start "WaitTimer" 10000ms 1 & repeat_start_instant 'levelSweep' 10ms 101 & level & param_smaller 1% ? stop & repeat_stop 'levelSweep' & stop & repeat_start "WaitTimer" 100ms 1 & level 100% : level -1%
What I'd like is a version of script 2, that uses a variable for the wait time rather than a set time. I tried just plugging in the variable in the original script but that didn't work:
play & repeat_start "WaitTimer" '@$deck1_fadeout' 1 & repeat_start_instant 'levelSweep' 10ms 101 & level & param_smaller 1% ? stop & repeat_stop 'levelSweep' & stop & repeat_start "WaitTimer" 100ms 1 & level 100% : level -1%
When that didn't work, I tried combining the two scripts, and that didn't work either. Not sure why, but rather than running the sweep, it just immediately stops.
play & repeat_start_instant "myTimer" 1000ms 181 & get_var '@$deck1_fadeout' & param_greater 'get_time elapsed 1000' ? nothing : repeat_stop "myTimer” & repeat_start_instant 'levelSweep' 10ms 101 & level & param_smaller 1% ? stop & repeat_stop 'levelSweep' & stop & repeat_start "WaitTimer" 100ms 1 & level 100% : level -1%
Broken down, here's what it should look like
play &
repeat_start_instant "myTimer" 1000ms 181 &
.....get_var '@$deck1_fadeout' & param_greater 'get_time elapsed 1000' ?
..........// var is greater than time elapsed
..........nothing :
..........// var is less than time elapsed
..........repeat_stop "myTimer” &
..........repeat_start_instant 'levelSweep' 10ms 101 &
...............level & param_smaller 1% ?
....................// smaller than 1%
....................stop &
....................repeat_stop 'levelSweep' &
....................stop &
....................repeat_start "WaitTimer" 100ms 1 & level 100% :
....................// not smaller than 1%
....................level -1%
Thanks in advance for any help!
Mensajes Wed 28 Mar 18 @ 9:19 pm
For context, here is how i set the variable:
Note - there are two versions of the variable. One is deck1_fadeout (raw number from 0 - 120000 only by 1000 increments) and the other is deck1_fadeout_sec (same is deck1_fadeout but cast as ms). Neither works in any of the above scripts.
<panel class="knobgray" x="+58" y="+13" visible="yes">
<slider action="param_multiply 120 & param_cast 'int' & param_multiply 1000 & set '@$deck1_fadeout'" dblclick="set '@$deck1_fadeout' 0" />
<slider action="param_multiply 120 & param_cast 'int' & param_multiply 1000 & set '@$deck1_fadeout'" dblclick="set '@$deck1_fadeout' 0" frommiddle="no 120 1"/>
<textzone><text action="get_var '@$deck1_fadeout' & param_cast 'ms' & set '@deck1_fadeout_sec' & get_var '@$deck1_fadeout_sec'" /></textzone>
</panel>
Note - there are two versions of the variable. One is deck1_fadeout (raw number from 0 - 120000 only by 1000 increments) and the other is deck1_fadeout_sec (same is deck1_fadeout but cast as ms). Neither works in any of the above scripts.
Mensajes Wed 28 Mar 18 @ 9:24 pm
Your entire logic (on script 2) is wrong IMHO.
First of all it's NOT a good idea to nest 2 different repeat_start actions.
Personally I would use a different approach:
I would get the time elapsed at the moment the action starts, I would then add the variable to it to calculate the time it should end, and then I would use a repeat action to check the elapsed time to determine when my fade should start
First of all it's NOT a good idea to nest 2 different repeat_start actions.
Personally I would use a different approach:
I would get the time elapsed at the moment the action starts, I would then add the variable to it to calculate the time it should end, and then I would use a repeat action to check the elapsed time to determine when my fade should start
Mensajes Wed 28 Mar 18 @ 9:34 pm
Locodog wrote that script and has been sharing variations of it on the forums for ages now. It works like a charm and I've used it in production situations to great success with variations on the initial wait timer. If you look closely, the repeat_starts aren't even actually nested, one of them stops, then another one begins. That's not even my issue, that script works great.
Mensajes Thu 29 Mar 18 @ 12:13 am
PhantomDeejay wrote :
Your entire logic (on script 2) is wrong IMHO.
First of all it's NOT a good idea to nest 2 different repeat_start actions.
Personally I would use a different approach:
I would get the time elapsed at the moment the action starts, I would then add the variable to it to calculate the time it should end, and then I would use a repeat action to check the elapsed time to determine when my fade should start
First of all it's NOT a good idea to nest 2 different repeat_start actions.
Personally I would use a different approach:
I would get the time elapsed at the moment the action starts, I would then add the variable to it to calculate the time it should end, and then I would use a repeat action to check the elapsed time to determine when my fade should start
I'm having trouble even parsing this suggestion. You say to never nest 2 different repeat_start actions but then you suggest I use a repeat action to set a timer with a nested repeat for the fade? Is there a way to fade to zero volume without using a repeat_start_instant command that I don't know about?
Forgive me - I'm still new to this and there isn't a good guide.
Mensajes Thu 29 Mar 18 @ 12:16 am
Perhaps I wasn't clear enough.
I said it's not a good idea to nest two repeat_start scripts and that statement still stands.
Yes, I did suggest two repeat_start actions as a solution, but they don't need to be nested.
Once the first repeat_start action determines that it's time to fade, it should stop itself and then execute the other (second) repeat_start action.
PS: I cannot enter your logic by your scripts. Therefore perhaps you should try to describe what you want to do (and try to keep the explanation simple) so that I can understand and maybe suggest a different approach.
I said it's not a good idea to nest two repeat_start scripts and that statement still stands.
Yes, I did suggest two repeat_start actions as a solution, but they don't need to be nested.
Once the first repeat_start action determines that it's time to fade, it should stop itself and then execute the other (second) repeat_start action.
PS: I cannot enter your logic by your scripts. Therefore perhaps you should try to describe what you want to do (and try to keep the explanation simple) so that I can understand and maybe suggest a different approach.
Mensajes Thu 29 Mar 18 @ 7:11 am
PhantomDeejay wrote :
Perhaps I wasn't clear enough.
I said it's not a good idea to nest two repeat_start scripts and that statement still stands.
Yes, I did suggest two repeat_start actions as a solution, but they don't need to be nested.
Once the first repeat_start action determines that it's time to fade, it should stop itself and then execute the other (second) repeat_start action.
PS: I cannot enter your logic by your scripts. Therefore perhaps you should try to describe what you want to do (and try to keep the explanation simple) so that I can understand and maybe suggest a different approach.
I said it's not a good idea to nest two repeat_start scripts and that statement still stands.
Yes, I did suggest two repeat_start actions as a solution, but they don't need to be nested.
Once the first repeat_start action determines that it's time to fade, it should stop itself and then execute the other (second) repeat_start action.
PS: I cannot enter your logic by your scripts. Therefore perhaps you should try to describe what you want to do (and try to keep the explanation simple) so that I can understand and maybe suggest a different approach.
What I'm trying to do is relatively simple. I run the music for ballroom dance competitions. Each event has a length of approximately one minute to ninety seconds. There are hundreds of events throughout a day and, as the day goes by, it's often necessary to shorten those events. Their length needs to be fluid based on how far behind the event is running. Script number two does EXACTLY what you suggest, only it does so statically. It sets a repeat_start timer for 10000ms (just for testing). It then stops said timer, starts a repeat_start_instant to do a fade over 10s. I use this script all the time. I actually use about eight variations with different "WaitTimer" values on it for different event lengths. What I'm really trying to do here is replace the eight different scripts with a single script and a knob that sets the fade length using a variable. This would allow me to adjust event length on the fly based on the event-runner's needs. Last event, I kept having to re-write scripts on the fly to adjust for event length and that made me uncomfortable (even though it *did* work, kudos on a killer, reliable scripting engine!).
As I mentioned, this script (previously referred to as script 2) works like a charm. You simply change the "WaitTimer" parameter to the event length:
play & repeat_start "WaitTimer" 10000ms 1 & repeat_start_instant 'levelSweep' 10ms 101 & level & param_smaller 1% ? stop & repeat_stop 'levelSweep' & stop & repeat_start "WaitTimer" 100ms 1 & level 100% : level -1%
Essentially, what I'd really like to do is something like this (where @$variable is the variable set by my custom knob):
play & repeat_start "WaitTimer" '@$variable' 1 & repeat_start_instant 'levelSweep' 10ms 101 & level & param_smaller 1% ? stop & repeat_stop 'levelSweep' & stop & repeat_start "WaitTimer" 100ms 1 & level 100% : level -1%
The problem I'm running into is that, no matter what I try, I can't get the '@$variable' to be accepted as the second parameter for the repeat_start verb.
I've tried all of the following variations to no success:
repeat_start "WaitTimer" '@$variable' 1
repeat_start "WaitTimer" "get_var '@$variable'" 1
repeat_start "WaitTimer" "`get_var '@$variable'" 1
repeat_start "WaitTimer" "`get_var '@$variable'`" 1
get_var '@$variable' & repeat_start "WaitTimer"
I get the feeling that there is a way to do this, I'm just missing it due to lack of understanding.
P.S. - When I read my previous comments, I come across as frustrated and belligerent. Sorry about that. I'm not sure why, as I am having a helluva lot of fun fooling around with this stuff. I've said this before, and I'll say it again - this is an amazing program that offers incomparable flexibility. I'm continually pleased by the level of support I receive on incredibly arcane questions. Basically, y'all rock and thanks!
Mensajes Thu 29 Mar 18 @ 1:13 pm
I feel it's also important to stress that I know there are probably easier ways of doing this (POI, just sticking with my existing buttons, etc). A BIG portion of my approach here is that I want to get much better at VDJ script, so I'm trying to tackle this with a programmatic approach (the tip about not nesting repeat_starts is huge, btw, thanks for that!).
In other words, it's just as important to me to answer the underlying question here of "Can you use a variable as a parameter in this instance?" as it is to arrive to a solution. I say this because there's often, on this forum, a well-intentioned tendency to suggest alternative approaches in the name of arriving at an answer. While those are certainly welcome in the interest of solving the issue I face, I'm still curious about the programming question itself.
In other words, it's just as important to me to answer the underlying question here of "Can you use a variable as a parameter in this instance?" as it is to arrive to a solution. I say this because there's often, on this forum, a well-intentioned tendency to suggest alternative approaches in the name of arriving at an answer. While those are certainly welcome in the interest of solving the issue I face, I'm still curious about the programming question itself.
Mensajes Thu 29 Mar 18 @ 1:18 pm