Looks good, but you could avoid using var 'syncOn' if you are just using it to fire a LED
by just mapping the led to
pitch_zero ? off : on
Also you queried action_deck too early, you don't need it until just before beat_lock [not that it matters if it works, it works!]
This is my shot at it (untested)(led needs to be mapped seperate)
holding ? sync : play_sync & action_deck 1 ? deck 2 beatlock on & deck 1 pitch_reset 0.5% & repeat_start 'lightBPM' 200ms 100 & get_pitch_zero ? repeat_stop 'lightBPM' & deck 2 beatlock off : nothing : deck 1 beatlock on & deck 2 pitch_reset 0.5% & repeat_start 'lightBPM' 200ms 100 & get_pitch_zero ? repeat_stop 'lightBPM' & deck 1 beatlock off : nothing
by just mapping the led to
pitch_zero ? off : on
Also you queried action_deck too early, you don't need it until just before beat_lock [not that it matters if it works, it works!]
This is my shot at it (untested)(led needs to be mapped seperate)
holding ? sync : play_sync & action_deck 1 ? deck 2 beatlock on & deck 1 pitch_reset 0.5% & repeat_start 'lightBPM' 200ms 100 & get_pitch_zero ? repeat_stop 'lightBPM' & deck 2 beatlock off : nothing : deck 1 beatlock on & deck 2 pitch_reset 0.5% & repeat_start 'lightBPM' 200ms 100 & get_pitch_zero ? repeat_stop 'lightBPM' & deck 1 beatlock off : nothing
holding
..? sync
..: play_sync &
....action_deck 1
....? deck 2 beatlock on &
......deck 1 pitch_reset 0.5% &
......repeat_start 'lightBPM' 200ms 100 &
......get_pitch_zero
......? repeat_stop 'lightBPM' &
........deck 2 beatlock off
......: nothing
....: deck 1 beatlock on &
......deck 2 pitch_reset 0.5% &
......repeat_start 'lightBPM' 200ms 100 &
......get_pitch_zero
......? repeat_stop 'lightBPM' &
........deck 1 beatlock off
......: nothing
Posted Mon 13 May 19 @ 2:39 pm
Thanks Loco! I'll pay attention to that.
Posted Tue 14 May 19 @ 8:22 am
repeat_start
repeat_start_instant
repeat_stop
repeat_start actions are possibly the most powerful of all vdj scripts, and they're really simple to get started with.
repeat_start_instant "giveThisAName" XXms Y & YOUR ACTION
XX the fastest it can repeat is about 25ms
Y the number of times your action will be called [optional, omit if you are going to stop the repeat_action manually, or you can use 0]
example
repeat_start_instant "stupidPlayPause" 468.75ms 32 & play_pause
press the button and instantly play_pause is called, then every 467.75ms [1 beat at 128bpm, I'm honestly not sure if it considers the fraction of the ms] play_pause is called again. All together play_pause will be called 32 times [including the first call], it's job is done and it stops.
before you try that out, set up another button
repeat_stop 'stupidPlayPause'
...because the repeat_action is annoying and listening to that for 16 beats would be painful. That just bypasses the count and stops it instantly.
repeat_start "stupidPlayPause" 468.75ms 32 & play_pause
this does the same thing but will wait 468.75ms before first performing the action.
Ok I put a manually put time in, how about vdj putting a time in dynamically? Strap in.
[POST EDIT The info below is dated, still functional so I'll keep it for now (and covers some useful concepts)
Build 6404 now allows the time param to be measured in beats.
It also allows the time param and the repeat count param to be set with variables. More info here
http://www.virtualdj.com/forums/223743/General_Discussion/Script_School.html?page=14.65 ]
To get ms/beat we need to 60,000 / bpm, but vdj has no param_divide action so we need to 60,000 * (1/bpm) that we can do
param_multiply "get_bpm & param_1_x" 60000
we could save this as a variable if we want
set 'oneBeatMS' `param_multiply "get_bpm & param_1_x" 60000`
Now how to give this value to the repeat_start
set 'oneBeatMS' `param_multiply "get_bpm & param_1_x" 60000` & param_cast 'ms' & repeat_start 'stupidPlayPause' & play_pause
Notice here we haven't included a time to the repeat_start [as the time is cast to the script]
We also haven't included a count, well we can't, cast values always go on the end and for repeat_start the first parameter is time, we have to make our own counter but it's not very hard.
To make a counter just after "play_pause" we will cycle a variable [cycle; increase or decrease by 1. cycle 'varName X, X being the number it will loop back round to zero] then query the value against our desired maximum.
if true we stop the repeat_start, if false we do nothing and let it carry on.
set 'oneBeatMS' `param_multiply "get_bpm & param_1_x" 60000` & param_cast 'ms' & repeat_start 'stupidPlayPause' & play_pause & cycle 'SPP' 33 & var_equal 'SSP' 32 ? repeat_stop 'stupidPlayPause' & set 'SPP' 0 : nothing
we cycle 33 so we actually make it to 32 and when we stop the repeat_start we also reset the var [SPP] to 0, or we could do this to be a bit neater
set 'oneBeatMS' `param_multiply "get_bpm & param_1_x" 60000` & param_cast 'ms' & repeat_start 'stupidPlayPause' & play_pause & cycle 'SPP' 32 & var_equal 'SSP' 0 ? repeat_stop 'stupidPlayPause' : nothing
Isolated that works fine, for some scripts that will do, but what happens if you press this button while it is already running or call repeat_stop from another button.
The counter won't be right, let's reset the counter when we press the button.
set 'SSP' 0 & set 'oneBeatMS' `param_multiply "get_bpm & param_1_x" 60000` & param_cast 'ms' & repeat_start 'stupidPlayPause' & play_pause & cycle 'SPP' 32 & var_equal 'SSP' 0 ? repeat_stop 'stupidPlayPause' : nothing
That's about it, other than other beat lengths, say you want 1/2 beat, well
param_multiply "get_var 'oneBeatMS'" 0.5
set 'oneBeatMS' `param_multiply "get_bpm & param_1_x" 60000` & param_multiply "get_var 'oneBeatMS'" 0.5 & param_cast 'ms' & repeat_start 'stupidPlayPause' & play_pause & cycle 'SPP' 32 & var_equal 'SSP' 0 ? repeat_stop 'stupidPlayPause' : nothing
Anywho that's it for now, next time WILL be changing settings via script.
repeat_start_instant
repeat_stop
repeat_start actions are possibly the most powerful of all vdj scripts, and they're really simple to get started with.
repeat_start_instant "giveThisAName" XXms Y & YOUR ACTION
XX the fastest it can repeat is about 25ms
Y the number of times your action will be called [optional, omit if you are going to stop the repeat_action manually, or you can use 0]
example
repeat_start_instant "stupidPlayPause" 468.75ms 32 & play_pause
press the button and instantly play_pause is called, then every 467.75ms [1 beat at 128bpm, I'm honestly not sure if it considers the fraction of the ms] play_pause is called again. All together play_pause will be called 32 times [including the first call], it's job is done and it stops.
before you try that out, set up another button
repeat_stop 'stupidPlayPause'
...because the repeat_action is annoying and listening to that for 16 beats would be painful. That just bypasses the count and stops it instantly.
repeat_start "stupidPlayPause" 468.75ms 32 & play_pause
this does the same thing but will wait 468.75ms before first performing the action.
Ok I put a manually put time in, how about vdj putting a time in dynamically? Strap in.
[POST EDIT The info below is dated, still functional so I'll keep it for now (and covers some useful concepts)
Build 6404 now allows the time param to be measured in beats.
It also allows the time param and the repeat count param to be set with variables. More info here
http://www.virtualdj.com/forums/223743/General_Discussion/Script_School.html?page=14.65 ]
To get ms/beat we need to 60,000 / bpm, but vdj has no param_divide action so we need to 60,000 * (1/bpm) that we can do
param_multiply "get_bpm & param_1_x" 60000
we could save this as a variable if we want
set 'oneBeatMS' `param_multiply "get_bpm & param_1_x" 60000`
Now how to give this value to the repeat_start
set 'oneBeatMS' `param_multiply "get_bpm & param_1_x" 60000` & param_cast 'ms' & repeat_start 'stupidPlayPause' & play_pause
Notice here we haven't included a time to the repeat_start [as the time is cast to the script]
We also haven't included a count, well we can't, cast values always go on the end and for repeat_start the first parameter is time, we have to make our own counter but it's not very hard.
To make a counter just after "play_pause" we will cycle a variable [cycle; increase or decrease by 1. cycle 'varName X, X being the number it will loop back round to zero] then query the value against our desired maximum.
if true we stop the repeat_start, if false we do nothing and let it carry on.
set 'oneBeatMS' `param_multiply "get_bpm & param_1_x" 60000` & param_cast 'ms' & repeat_start 'stupidPlayPause' & play_pause & cycle 'SPP' 33 & var_equal 'SSP' 32 ? repeat_stop 'stupidPlayPause' & set 'SPP' 0 : nothing
we cycle 33 so we actually make it to 32 and when we stop the repeat_start we also reset the var [SPP] to 0, or we could do this to be a bit neater
set 'oneBeatMS' `param_multiply "get_bpm & param_1_x" 60000` & param_cast 'ms' & repeat_start 'stupidPlayPause' & play_pause & cycle 'SPP' 32 & var_equal 'SSP' 0 ? repeat_stop 'stupidPlayPause' : nothing
Isolated that works fine, for some scripts that will do, but what happens if you press this button while it is already running or call repeat_stop from another button.
The counter won't be right, let's reset the counter when we press the button.
set 'SSP' 0 & set 'oneBeatMS' `param_multiply "get_bpm & param_1_x" 60000` & param_cast 'ms' & repeat_start 'stupidPlayPause' & play_pause & cycle 'SPP' 32 & var_equal 'SSP' 0 ? repeat_stop 'stupidPlayPause' : nothing
That's about it, other than other beat lengths, say you want 1/2 beat, well
param_multiply "get_var 'oneBeatMS'" 0.5
set 'oneBeatMS' `param_multiply "get_bpm & param_1_x" 60000` & param_multiply "get_var 'oneBeatMS'" 0.5 & param_cast 'ms' & repeat_start 'stupidPlayPause' & play_pause & cycle 'SPP' 32 & var_equal 'SSP' 0 ? repeat_stop 'stupidPlayPause' : nothing
Anywho that's it for now, next time WILL be changing settings via script.
Posted Wed 29 May 19 @ 8:17 pm
set 'oneBeatMS' `param_multiply "get_bpm & param_1_x" 60000` & param_cast 'ms' & repeat_start 'stupidPlayPause' & play_pause & cycle 'SPP' 33 & var_equal 'SSP' 32 ? repeat_stop 'stupidPlayPause' & set 'SPP' 0 : nothing
we cycle 33 so we actually make it to 32 and when we stop the repeat_start we also reset the var [SPP] to 0, or we could do this to be a bit neater
is this not a simple cycle 32 or is there any difference ?
set 'oneBeatMS' `param_multiply "get_bpm & param_1_x" 60000` & param_cast 'ms' & repeat_start 'stupidPlayPause' & play_pause & cycle 'SPP' 32 & var_equal 'SSP' 0 ? repeat_stop 'stupidPlayPause' : nothing
Anywho that's it for now, next time WILL be changing settings via script.
hope you'll specify the list of settings allowed to be read/written because somme seems to be restricted i.e. "effects"
we cycle 33 so we actually make it to 32 and when we stop the repeat_start we also reset the var [SPP] to 0, or we could do this to be a bit neater
is this not a simple cycle 32 or is there any difference ?
set 'oneBeatMS' `param_multiply "get_bpm & param_1_x" 60000` & param_cast 'ms' & repeat_start 'stupidPlayPause' & play_pause & cycle 'SPP' 32 & var_equal 'SSP' 0 ? repeat_stop 'stupidPlayPause' : nothing
Anywho that's it for now, next time WILL be changing settings via script.
hope you'll specify the list of settings allowed to be read/written because somme seems to be restricted i.e. "effects"
Posted Thu 30 May 19 @ 6:18 pm
No difference, [except neater] In the very next script after that one I did cycle 32 (and said it was neater) but I had just introduced the "cycle" action, and it was just to it break it into easily understood steps [first explain how we think, then highlight the small difference of how the program works]
Yeah Settings honestly I don't know the full list of ones allowed to be scripted to, I'd love to be able to do setting "browserColumns" it's a right pain when I've had guests on my rig..
I think I'm just going to give examples of the more common ones and leave users to try stuff
Yeah Settings honestly I don't know the full list of ones allowed to be scripted to, I'd love to be able to do setting "browserColumns" it's a right pain when I've had guests on my rig..
I think I'm just going to give examples of the more common ones and leave users to try stuff
Posted Thu 30 May 19 @ 6:40 pm
yes, some as "browserColumns" may finally be understood, have to find the list of possible parameters but some other as "browserSort" badly wont be scriptable for everybody as its parameters are translated depending on the active language.xml :/
Posted Thu 30 May 19 @ 6:53 pm
A small unsexy addition that came with v8.4 [2020] that actual could be a big thing
variables can now hold strings
Set [capture] like this
set 'test1' `get_text 'hello'`
set 'test2' `get_browsed_song "artist"`
And you can compare just like any other variable
prove it with custom_button led logic
param_equal `get_var test1` 'hello' ? on : off
check what the var actually is with this as a custom_button name
`get_var test1`
or inspect with the var list viewer
var_list
I'll post more as I figure any nuances
variables can now hold strings
Set [capture] like this
set 'test1' `get_text 'hello'`
set 'test2' `get_browsed_song "artist"`
And you can compare just like any other variable
prove it with custom_button led logic
param_equal `get_var test1` 'hello' ? on : off
check what the var actually is with this as a custom_button name
`get_var test1`
or inspect with the var list viewer
var_list
I'll post more as I figure any nuances
Posted Tue 24 Sep 19 @ 10:37 am
Hi, a quick, question -
I want to be able to turn on a specific shader (eg: "geometry") and then control transparency in the poi editor.
I tried effect_string "shader" 1 "geometry" & effect_slider "shader" 1 +0% but they do not work for me.
can anyone advise?
Tks
I want to be able to turn on a specific shader (eg: "geometry") and then control transparency in the poi editor.
I tried effect_string "shader" 1 "geometry" & effect_slider "shader" 1 +0% but they do not work for me.
can anyone advise?
Tks
Posted Wed 30 Oct 19 @ 4:11 am
As locodog said previous page:
Button 1 : show position & size selection tool
Button 2 : AutoChange
Button 3 : BeatMove
Slider 1 : Shader selection
Slider 2 : Transparency
String 1 : Indexed name ... the one on Shadertoy
String 2 : Prety name ... the one we understand
Only shader selection (slider 1) reflect in the GUI, all other actions are not reported
however transparency, BeatMove and AutoChange are effective even not updated in the gui
NOT working anymore ?
When a shader or folder is specified by any of its name , the string is affected, querying them gives the changed value, but nothing apply
maybe some extra action is needed or syntax change ?
for transparency use :
deck master effect_slider 'shader' 2 50%
for a shader...
deck master effect_slider 'shader' 1 12%
it is working but have to know the relative position in the list "All"
Don't play too much with it actually.. it crashed some of my PC just using it ... VDJ still up but WindowManager totally broken.. and another one got BSOD
was working fine before last summer
Button 1 : show position & size selection tool
Button 2 : AutoChange
Button 3 : BeatMove
Slider 1 : Shader selection
Slider 2 : Transparency
String 1 : Indexed name ... the one on Shadertoy
String 2 : Prety name ... the one we understand
Only shader selection (slider 1) reflect in the GUI, all other actions are not reported
however transparency, BeatMove and AutoChange are effective even not updated in the gui
NOT working anymore ?
When a shader or folder is specified by any of its name , the string is affected, querying them gives the changed value, but nothing apply
maybe some extra action is needed or syntax change ?
for transparency use :
deck master effect_slider 'shader' 2 50%
for a shader...
deck master effect_slider 'shader' 1 12%
it is working but have to know the relative position in the list "All"
Don't play too much with it actually.. it crashed some of my PC just using it ... VDJ still up but WindowManager totally broken.. and another one got BSOD
was working fine before last summer
Posted Wed 30 Oct 19 @ 8:25 am
I've reported effect string not working but the "nudge" of slider 1 [shader select]workaround works here
Posted Wed 30 Oct 19 @ 9:50 am
Just a little thing I've been playing with for NYE, for your 1 hour/ 30minutes /10 minutes etc to go, you'll have something planned yourself
but just as general countdown for your video out you could do this
firstly set some variables, say you start showing your countdown at 9:30pm, 2 & a half hours to go, also turn text fx on
set 'hour' 2 & set 'min' 30 & set 'sec' 0 & effect_active 'text' 1
Second start these variables counting down [really you could do script 1 & 2 together]
repeat_start 'tCounter' 1000ms & cycle 'sec' -60 & var 'sec' 59 ? cycle 'min' -60 & var 'min' 59 ? cycle 'hour' -24 : : :
Third put these variables into a text string & send it to the text fx
repeat_start 'clock2text' 1000ms & get_text "`get_var 'hour' & param_cast '00'`:`get_var 'min' & param_cast '00'`:`get_var 'sec' & param_cast '00'`" & param_cast 'text' & effect_string 'text' 2
realistically you'd ditch this at 1 minute to go and you could kill it via event schedule at 23:58:59 with something like this
repeat_stop 'tcounter' & repeat_stop 'clock2text' & effect_active 'text' 0
And honestly you could put the countdown together with 1 script [I broke it up to make it easier to understand]
set 'hour' 2 & set 'min' 30 & set 'sec' 00 & effect_active 'text' 1 & repeat_start 'clock2text' 1000ms & get_text "`get_var 'hour' & param_cast '00'`:`get_var 'min' & param_cast '00'`:`get_var 'sec' & param_cast '00'`" & param_cast 'text' & effect_string 'text' 2 & cycle 'sec' -60 & var 'sec' 59 ? cycle 'min' -60 & var 'min' 59 ? cycle 'hour' -24 : : :
but just as general countdown for your video out you could do this
firstly set some variables, say you start showing your countdown at 9:30pm, 2 & a half hours to go, also turn text fx on
set 'hour' 2 & set 'min' 30 & set 'sec' 0 & effect_active 'text' 1
Second start these variables counting down [really you could do script 1 & 2 together]
repeat_start 'tCounter' 1000ms & cycle 'sec' -60 & var 'sec' 59 ? cycle 'min' -60 & var 'min' 59 ? cycle 'hour' -24 : : :
Third put these variables into a text string & send it to the text fx
repeat_start 'clock2text' 1000ms & get_text "`get_var 'hour' & param_cast '00'`:`get_var 'min' & param_cast '00'`:`get_var 'sec' & param_cast '00'`" & param_cast 'text' & effect_string 'text' 2
realistically you'd ditch this at 1 minute to go and you could kill it via event schedule at 23:58:59 with something like this
repeat_stop 'tcounter' & repeat_stop 'clock2text' & effect_active 'text' 0
And honestly you could put the countdown together with 1 script [I broke it up to make it easier to understand]
set 'hour' 2 & set 'min' 30 & set 'sec' 00 & effect_active 'text' 1 & repeat_start 'clock2text' 1000ms & get_text "`get_var 'hour' & param_cast '00'`:`get_var 'min' & param_cast '00'`:`get_var 'sec' & param_cast '00'`" & param_cast 'text' & effect_string 'text' 2 & cycle 'sec' -60 & var 'sec' 59 ? cycle 'min' -60 & var 'min' 59 ? cycle 'hour' -24 : : :
Posted Sat 23 Nov 19 @ 7:54 pm