Quick Sign In:  

Forum: General Discussion

Topic: Script School - Page: 14

This part of topic is old and might contain outdated or incorrect information

twagaPRO InfinityMember since 2009
I want to write VDJscript to scratch back to the cue point.
Can we do it?

 

Posted Thu 11 Mar 21 @ 3:38 pm
How can one query value of an OPTION in settings?

Wanted to create a Custom button called, " Preview" that would play 30 sec of each track in automix .

automixMaxLength 0 ? setting automixMaxLength 30 : setting automixMaxLength 0

and
param_equal "`automixMaxLength` 0" ? setting automixMaxLength 30 : setting automixMaxLength 0


both do not work because I don't know how to query the value of automixMaxLength

Help
 

Posted Sun 14 Mar 21 @ 8:10 pm
NicotuxHome userMember since 2014
this is a setting ^^ as you know, just don't miss it :
setting automixMaxLength 0 ? setting automixMaxLength 30 : setting automixMaxLength 0
or shorter
setting automixMaxLength ? setting automixMaxLength 0 : setting automixMaxLength 30
 

Posted Sun 14 Mar 21 @ 8:24 pm
Thank you, Nicotux for your quick and amazing help

Worked perfectly ! !

Thanks again :)

-------------
PS
What would I add to the script, to have the custom button lite up when in preview mode?

setting automixMaxLength 0 ? setting automixMaxLength 30 & on : setting automixMaxLength 0 & off

does not work

How does one turn on and off a custom button's 'LED' ?
 

Posted Sun 14 Mar 21 @ 8:36 pm
put on and off first

on & setting automixMaxLength 30
 

Posted Sun 14 Mar 21 @ 9:09 pm
Thanks Rune ! !

Always learning from your posts ..

Works as expected now !

would not have thought of that solution.
 

Posted Sun 14 Mar 21 @ 9:13 pm
Hi, I have the brakstart effect mapped to a pad with:
effect_active 'brakestart' while_pressed

So if I press the pad the effect is activated, but when I release the pad it doesn't turn off.

How could I do, so that when pressing the effect is activated and when releasing the pad the effect is turned off?
 

Posted Tue 16 Mar 21 @ 8:45 pm
XIVAN MAR. wrote :

effect_active 'brakestart' while_pressed


works fine here. What you want to happen?
 

Posted Tue 16 Mar 21 @ 8:57 pm
I would like:

Hold down the pad to turn the effect on and releasing the pad pressure turns the effect off.

Rune (dj-in-norway) wrote :
XIVAN MAR. wrote :

effect_active 'brakestart' while_pressed


works fine here. What you want to happen?


 

Posted Tue 16 Mar 21 @ 9:19 pm
XIVAN MAR. wrote :
I would like:
Hold down the pad to turn the effect on and releasing the pad pressure turns the effect off.


effect_active 'brakestart' while_pressed already does that.. works that way.
Maybe you spelled something wrong? Or used somewhere wrong?
Use it as regular action if on pads.. (not "pad pressure" but push action)

 

Posted Tue 16 Mar 21 @ 9:54 pm
Because releasing the pressure of the pad continues to activate the effect.

Okay, I'll re-activate it and test it in push action.


Rune (dj-in-norway) wrote :
XIVAN MAR. wrote :
I would like:
Hold down the pad to turn the effect on and releasing the pad pressure turns the effect off.


effect_active 'brakestart' while_pressed already does that.. works that way.
Maybe you spelled something wrong? Or used somewhere wrong?
Use it as regular action if on pads.. (not "pad pressure" but push action)



 

Posted Tue 16 Mar 21 @ 10:09 pm
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
A.eXe 1PRO InfinityMember since 2011
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
29%