As a part of the more complicated script, I need to do a repeating script that does "goto +4", "goto +8", "goto +12" and "goto +16" etc.... were incremental value is read from variable.
This is what I have tried so far:
var_list shows that the $fwd is incremented correctly: 4,8,12,16. But "goto" does not do right thing. First it goes to position 0 and then does "goto +4" repeatedly, no incremental change. Actually, if I change param_add to value x, it repeatly does "goto +x". Why, I don't know... Maybe something wrong with the param cast?
var_list and milliseconds are for debugging each iteration, you can try the script to a button, you need to load a track first, then press the button.
Any help from script gurus? :)
This is what I have tried so far:
set "$fwd" 4 & repeat_start_instant 'goFwd' 1000ms 4 & get_var "$fwd" & param_cast & goto & songpos_remain 0.001 ? set "$fwd" '`get_var "$fwd" & param_add 4' &var_list : goto_first_beat & repeat_stop 'goFwd' & var_list
var_list shows that the $fwd is incremented correctly: 4,8,12,16. But "goto" does not do right thing. First it goes to position 0 and then does "goto +4" repeatedly, no incremental change. Actually, if I change param_add to value x, it repeatly does "goto +x". Why, I don't know... Maybe something wrong with the param cast?
var_list and milliseconds are for debugging each iteration, you can try the script to a button, you need to load a track first, then press the button.
Any help from script gurus? :)
Posted Mon 13 Feb 17 @ 3:13 pm
goto expects a number right afterwards: goto +16
When you don't specify the value, it uses implicitly values (last value called by your script)
Also it's NOT a wise choice to open a window (like var_list) while a repeat script is running.
Can you explain better what you want to do ? because your script can be written completely differently in order to achieve the same result.
When you don't specify the value, it uses implicitly values (last value called by your script)
Also it's NOT a wise choice to open a window (like var_list) while a repeat script is running.
Can you explain better what you want to do ? because your script can be written completely differently in order to achieve the same result.
Posted Tue 14 Feb 17 @ 12:43 am
Okay, the simpler problem is to read value from variable and move deck amount of beats forward or backward. For example:
Should move the deck 4 beats onwards, but it does not work :(
set "$move" 4 & get_var "$move" & param_cast & goto
Should move the deck 4 beats onwards, but it does not work :(
Posted Tue 14 Feb 17 @ 9:01 am
Why ?
For a repeat script why you need to set and read the variable every time ? It's just wrong way of doing things...
Instead of:
repeat_start_instant 'goFwd' 1000ms 4 & set "$move" 4 & get_var "$move" & param_cast & goto
you could just use:
repeat_start_instant 'goFwd' 1000ms 4 & goto +4
Unless you're trying to do something more fancy, your initial script is just using the "wrong way"
Therefore please let us know EXACTLY what you want to do in order to provide the best suited script
For a repeat script why you need to set and read the variable every time ? It's just wrong way of doing things...
Instead of:
repeat_start_instant 'goFwd' 1000ms 4 & set "$move" 4 & get_var "$move" & param_cast & goto
you could just use:
repeat_start_instant 'goFwd' 1000ms 4 & goto +4
Unless you're trying to do something more fancy, your initial script is just using the "wrong way"
Therefore please let us know EXACTLY what you want to do in order to provide the best suited script
Posted Tue 14 Feb 17 @ 1:04 pm
Another way is instead off adding 4 every repeat, just cycle a variable up, query the variable and have a specific goto + for specific var values,
If you can't get something working without it getting stupidly long, I've a plugin that allows you to bypass certain script rules,
PM me if you're stuck.
If you can't get something working without it getting stupidly long, I've a plugin that allows you to bypass certain script rules,
PM me if you're stuck.
Posted Tue 14 Feb 17 @ 4:32 pm
It need to be in a variable, that is increment by +4 every repeat. Well, I use the good old copy-paste from 4 up to 512, that's long script but working now as I wanted.
locodog; I could use that type of plugin. I constantly get ideas how to make better mapper for my controller. Thanks!
PS: still, if anyone knows how to do this idea:
i would appreciate it.
locodog; I could use that type of plugin. I constantly get ideas how to make better mapper for my controller. Thanks!
PS: still, if anyone knows how to do this idea:
goto +"$myVar"
i would appreciate it.
Posted Tue 14 Feb 17 @ 4:37 pm
jaakko wrote :
It need to be in a variable, that is increment by +4 every repeat.
It's your right not to want to share your script / scripting thought with us.
However this won't help you get a right working clean script.
Your variable is set on every repeat to be the exact same number. So, technically it's not a variable anymore but a CONSTANT!
This means that you use a completely wrong approach to program whatever function you want.
Setting and calling a single variable on every repeat instead of using a constant may practically have no impact on VirtualDj's CPU usage and RAM management, but if you expand this logic on several cases you will eventually increase CPU and RAM usage without being needed.
Sure you are a DJ, not a programmer, but using a variable as constant is Programming 101 of things NOT TO DO.
If the variable is meant to change outside your repeat call then reseting it within the repeat call is also wrong for 99.9% of cases I can think of.
So, if you want a more efficient script consider to share some more information with us. You don't need to share your entire scripting idea if you don't wish too. But at least let us know what you'r trying to do with this part of code. Because the way you write the code right now for the task it's supposed to do it makes absolutely no sense!
Posted Fri 17 Feb 17 @ 9:32 am