Quick Sign In:  

Forum: General Discussion

Topic: Script School - Page: 14.55
locodogPRO InfinityModeratorMember since 2013
I've been compiling a little list of script methods I found interesting. I might explain in detail later, higher level stuff [mostly, but not all], but I figure if you can read these you might learn a trick or two

Test if several things are true with just one question mark

set 'a' 1 & set 'b' 2 & set 'c' 3 & param_equal "`var 'a' 1 && var 'b' 2 && var 'c' 3`" 1 ? set 'result' 1 : set 'result' 0

between 2 values one question mark
param_equal "`param_smaller 'effect_slider echo 1' 0.1`" "`param_bigger 'effect_slider echo 1' 0.2`" ? [in between 0.1 & 0.2] : [not inbetween]

Increment vars [really old but it was a surprise to me when I found it]

set 'a' +1
set 'a' -1

cast then query for things that aren't straight forward [some verbs are only queries and can't be cast to in usual ways]

set 'a' 2 & get_var 'a' & param_cast 'integer' & has_cue & param_equal 1 ? [cue 2 exists] : [it doesn't]

inverted queries [pretty basic, but nice to know]

set 'a' 1 & set 'b' 1 & var_equal 'a' 'b' !? [not equal] : [equal]

Dynamic variable names [very recent discovery, kind of interesting, maybe needlessly complicated]

set '$myvar' 4 & param_add `get_var '$myvar' & param_cast 'text'` `get_text '$mynewvar'` & param_cast 'text' & toggle

result toggle $mynewvar4
 

Posted Sat 20 Mar 21 @ 10:52 pm
NicotuxHome userMember since 2014
Indirect name can be simple as well

the base: get_text 'tstvar' & param_cast text & toggle

the indirect: set tstname `get_text tstvar` & get_var tstname & param_cast text & toggle

in your example: uni dimensional array

and very more complex with a 2 dim array
set '$myvarX' 4 & set '$myvarY' 2 & param_add `param_add "get_var '$myvarY' & param_cast text" "get_var '$myvarX' & param_cast text & param_add 'x'"` "get_text '$mynewname'" & param_cast text & toggle

will toggle $mynewname4x2
(note param_add can add function with backquotes in the variable name in many case, maybe can be hack to indirect functions as well - I think to custom_button hack but didn't test)


Fine you talk about the increment and decrement because set behavior changed again with b6334;
HOW TO affect a negative value to a variable and deal with it is over complicated now?

no need of "set v 0 & set v -1" ... sounds like a good idea... at first

But side effects (and missing in implementation) brake many things :
i.e.: automatically casts parameter to relative :
set v `constant -1 & param cast_absolute`
Badly this is cast parameter as relative anyway

set v `constant -1 & param cast_absolute` & param_cast absolute
or better : "param_add 0 -1 & set v"
now parameter is absolute value -1
so that there is no gain compare to old behavior

BUT if its not a constant ....
set v2 `get_var v`
TOTALLY WRONG
result is undefined ; either v2 -v or v result being relative or absolute depending on v

HAVE TO set

set v2 `get_var v & param_cast absolute` & param_cast absolute
or
set v2 `get_var v & param_cast relative` & param_cast absolute

HOWEVER the parameter is now TOTALLY STRANGE
result parameter with positive values are now missing (more exactly a boolean takes place of the value)
if you test result : v2 < 0 then you can verify its value or go on affect other variables
but if V2 is positive the parameter becomes this time BOOLEAN :

set v `constant -42 & param_cast absolute` & param_cast absolute & set v2
v == v2 == -42
set v 42 & set v2
v==42 , v2 == 0
set v 0 , set v2
v==0 , v2 ==1

"set v0 `get_var v` & set v1 & set v2..."
depends on the value of v

.. not talking about text or uninit vars...
 

Posted Sun 21 Mar 21 @ 5:52 am
locodogPRO InfinityModeratorMember since 2013
Build 6404 just went early access and with that introduces a script tweek;

6404 EA Release Notes wrote :
repeat_start accepts time in beats as well (1.0bt instead of 500ms for example)

so to test it out, I made something like this for a button

repeat_start 'halfbar' ? repeat_stop 'halfbar' : set 'count' 0 & repeat_start 'halfbar' 2bt -1 & cycle 'count' 8 & var 'count' 0 !? goto +2 : goto -30

some tracks this sounds good, other tracks... don't really suit it. Try it out, you might like it.

but the EA release notes aren't the full story. Look at this script

set 'var1' 4 & repeat_start 'name' `get_var 'var1' & param_cast 'beats'` `get_var 'var1'` & goto -4


notice in place of the time|beats param, we have a variable cast as beats.
notice in place of the repeat count param, we also have a variable

so that works now. :)

If you're late to the party I've already covered the basics of
repeat_start, repeat_start_instant, repeat_stop
http://www.virtualdj.com/forums/223743/General_Discussion/Script_School.html?page=3.80
 

Posted Mon 12 Apr 21 @ 1:34 pm
SveninoPRO InfinityMember since 2009
Is it possible to lock the Shift-Funktion?
So that I push a button once to set shift
and push it again to unshift?
 

Posted Fri 23 Apr 21 @ 5:31 pm
locodogPRO InfinityModeratorMember since 2013
sometimes it's a hardware setting, sometimes it isn't.
but shift is usually a hardware layer, it can't be easily remapped from momentary to toggle, some cases it simply can't.
 

Posted Fri 23 Apr 21 @ 5:38 pm
NicotuxHome userMember since 2014
unless you use a hack with a rsi like that:
shift ? repeat_stop shlk & shift : repeat_start shlk 170ms -1 & not shift ? shift
 

Posted Fri 23 Apr 21 @ 6:11 pm
SveninoPRO InfinityMember since 2009
Sorry Nicotux, but there pops up a window with a debug message.
It´s not so useful...
Is there really no option for such an easy thing?
 

Posted Fri 23 Apr 21 @ 6:18 pm
NicotuxHome userMember since 2014
you got it quickly, I almost removed the debug thing immediately :-)
 

Posted Fri 23 Apr 21 @ 6:30 pm
Thanks @LOCODOG for starting up this post and keeping it going! There's A LOT of good information here.
With my limited knowledge on the repeat_start function I don't even know how to approach this.
Since build 6404 repeat_start accepts time in beats which to me could create some really nice automatic transitions & effects. One example : The idea is to press a button, isolate only_stem "Vocal", then have loop roll create a 16 bar build up.
 

Posted Sat 24 Apr 21 @ 10:45 am
locodogPRO InfinityModeratorMember since 2013
only_stem Vocal on & effect_active 'loop roll' on & effect_beats 'loop roll' 4 &  repeat_start 'voxRoll' 4bt 4 & effect_beats 'loop roll' 0.5 ? effect_active 'loop roll' off : effect_beats 'loop roll' -1


something like that?
I've got a project on with something similar but it has dump & slipbrake & odd sized loops but it's mainly aimed at jungle gabba & breakcore [fast]genres
 

Posted Sat 24 Apr 21 @ 11:47 am
Thank you so much @LOCO! This isn't working exactly how I had in mind but it's close. I'll keep messing with it until I get it.
That project that you're working on sounds like what I was thinking. This is for nu break/break beat genre and was thinking it would be sick to take the vocal of the current track , start the auto build up and transition straight into the next track's drop. There is a ton of other things that can be done with the recent additions to VDJ, I figured I'd start with this.
 

Posted Sat 24 Apr 21 @ 4:03 pm
Disregard - That works perfectly. I had my effect settings wrong. A little out of practice. : ) Thanks again.
 

Posted Sat 24 Apr 21 @ 8:05 pm
SveninoPRO InfinityMember since 2009
Sorry Nicotux, but it´s still not working.
The Button with Your Code shifts only during it´s pressed.

Nicotux wrote :
unless you use a hack with a rsi like that:
shift ? repeat_stop shlk & shift : repeat_start shlk 170ms -1 & not shift ? shift


The aim was to get a permanent shift by a short push of the button and a temporary (normal) shift when pressing the Button longer.
I want to press the Button long and have a permanent shift from leaving the button till pushing it again.
(Sorry, don´t know, why my staff always has to be so complicated ;-)
 

Posted Sun 25 Apr 21 @ 11:19 am
SveninoPRO InfinityMember since 2009
Background is f.i. to have a secondary assignment of certain buttons but
without the cumbersome setting of "$XYZ"-Variables.
So for the second unit of all buttons could be used shift ?
And if it´s activated (by the button with Your code) it´s not necessary to hold all the time the shift
 

Posted Sun 25 Apr 21 @ 11:24 am
NicotuxHome userMember since 2014
This one activates/desactivates shift lock with a short press, and shift normal with long press
You can adjust delay by modifying count (currently 3 = 510ms)
repeat_start shlk ? on & repeat_stop shlk & shift off : shift ? on & repeat_stop shlk & shift off : repeat_start shlk 170ms 3 & not shift ? shift 

maybe duration 170ms have to adjust as well depending on OS settings
 

Posted Sun 25 Apr 21 @ 1:13 pm
SveninoPRO InfinityMember since 2009
That works fine! Well done and thank You very much!
 

Posted Sun 25 Apr 21 @ 2:30 pm
I have solved this problem, and it works differently on different controllers. But I have a way so that you can double press and it stays on shift and an led will let you know when shift is active, and u hold it down and its reset, do u want the script
 

Posted Fri 07 May 21 @ 9:02 pm
i didn't notice the rest, but i have a whole script variation for shift, as i noticed some buttons are on off buttons and some don't react like that, my launch control has different buttons and they can be altered, but it means you have to add another script to the button as when shift is active the script is not active now
 

Posted Fri 07 May 21 @ 9:05 pm
NicotuxHome userMember since 2014
It's always interesting to have other points of view, so that scripts are always welcome

I thought I posted a "global" shift lock (not per deck) because button state is affected by the deck the repeat loop is running on
repeat_start shlk ? on & repeat_stop shlk & deck all shift off  : shift ? on & repeat_stop shlk & deck all shift off : repeat_start shlk 170ms 3 & not shift ? deck all shift 

shift key disables lock too

as explain, buttons reflect the state of the first action / query
if it look inverted, free to invert result too
(and swap actions it this was a test)
test ? action A : action B
not test ? action B : Action A
will do the same with inverted button state
 

Posted Fri 07 May 21 @ 10:26 pm
SveninoPRO InfinityMember since 2009
Hello, here is another little task I´m stucked on:
Want a button with two functions:
1. short press: start and stop the sampler (sample_pad 1)
2. long hold: Set a "Var" for volume change of this sampler without starting or stoping it.
(Holding this button is like a shift, so that a slider can control the volume of this sampler, but just as long You are holding the button)
Aim is to controll volume of different samplers with just one Slider. Holding the specific Button of the specific Sampler makes the Slider react just for this sampler volume (Variables "$s1v" "s2v" "s3v"...)
Now I have a Interim solution: It toggles the volume-change by double clicking on the button, while short pressing starts and stops the sampler:
var 'double' ? set 'double' 0 & repeat_stop 'myrep' & toggle "$s1v" : set 'double' 1 & repeat_start 'myrep' 200ms 1 & sampler_pad 1 & set 'double' 0

Problem 1: because of the waiting for the double click the sample starts 200 ms too late
Problem 2: If I forget to toggle it back and choosing another sampler, sampler 1 will be changing the volume too - unwanted.
Thats why a holding-down-solution would be much better...
But anyhow the "sampler_pad 1" command seems to not work in some strings...
So does anybody know, how to SHORT = sample_pad 1 LONG = set "$s1v" 1 than RELEASE = set "$s1v" 0

By the way: sampler 1 start/stop can´t be used, because only with sampler_pad 1
my samples stay in sync when started by external controller... (don´t ask me why)

Thanks a lot in advance
 

Posted Sun 23 May 21 @ 6:31 pm
64%