Anmelden:     


Forum: General Discussion

Topic: Script School - Page: 50.25
I'm turning in circles with something very simple. I want to duplicate the CFX level from deck 1 to deck 2. If it is 0.6 on deck 1, I'd like to copy that to deck 2 "deck 2 filter 0.6". I am able to set a variable $toto to 0.6, confirmed with VAR LIST but I have no clue how to apply the variable to "filter", and I guess I will also be unable to fill $toto with the actual "filter" value on deck 1. So what is the proper syntax to achieve "filter $toto"?
 

param_cast is what you use to put a variable on the end of a verb

get_var $toto & param_cast & deck 2 filter


to set a variable to a script action value, the set verb allows script actions as a parameter when the action is wrapped in ` `

set $toto `deck 1 filter`
 

Thanks, it works fine.
 

Q: can VDJ script be written as structured code?

I'm 51 years as a software developer, and the run-on "everything on one line" makes me squirm.

Is there a line continuation character or ?? that allows for writing more structured code?

Thanks in advance.
 

bgavin wrote :
run-on "everything on one line" makes me squirm.


return chars and tabs are understood as spaces.
 

Writing in structured form, this works correctly.
I use the 4-deck skin

set '%Src' 2 &
set '%Dst' 1 &
set '%Fader' 0.0

var_list shows these variables are correctly instantiated, but still show on [d3] even though created on [d2]
It is my understanding that percent types are local to the deck they are created on.

What is failing entirely is using the deck object with these variables.
deck %Src play
deck '%Src' play
deck `%Src` play

All fail.
I am puzzled, and cannot find any examples or cures out in Google land.

 

you want set_deck to do that kind of thing, deck verb doesn't accept script action as a parameter or as a cast.

vars created on wrong deck, must be something your end no problems here.
 

Hi
I have got a lightweight controller I use for some simple gigs but there are a few things it doesn't have for VDJ including an easy way to move around the browser panels without repurposing buttons I already need,
so I've reprogrammed the Track knob to include this when shifted:

'shift ? browser_window "folders,songs,sideview" & browser_window "folders" ? show_splitpanel 'Folders' on : show_splitpanel 'Folders' off : browser_scroll'

However when I scroll forward it works fine and moves between the different panels in order but when I scroll backwards it always goes from 'sideview' back to 'folders' then 'sideview' again, missing out the 'songs' panel.
Is this a parameter problem, with the back scroll decreasing a bit too much with each click and missing a step, if so, is there a way with some fancy math to reduce it so that when you scroll backwards it will allow it to work properly.
I don't mind if you have to turn the wheel more to achieve this.
 

without looking at why it is like it is, I can suggest going explicitly

shift ? param_bigger 0 ? browser_window "folders,songs,sideview" & browser_window "folders" ? show_splitpanel 'Folders' on : show_splitpanel 'Folders' off : browser_window folders ? show_splitpanel 'Folders' off & browser_window sideview : browser_window sideview ? browser_window songs : browser_window songs ?  show_splitpanel Folders on & browser_window folders : browser_scroll


not pretty but it's a one off
 

Your 'ugly' code is what I used originally on seperate buttons on my full controller until I 'refined' it as I learned better VDJ scripting and it does the job.
Where I fell down is remembering the nuance of how VDJscript works ('param_bigger 0' to check forward scroll etc) and I couldn't for the life of me work out how to transfer the old code to an knob so thanks again.
 

Thanks for the set_deck method. It works.

set '%Dst' 1 &
set_deck `get_var %Dst` & loaded ? play

It appears the crossfader doesn't like parameters either.
I don't find an equivalent for crossfader such as "set_crossfader" which does not exit.

These all fail:
crossfader %Fader
crossfader '%Fader'
crossfader `get_var %Fader`
crossfader `get_var '%Fader'`

 

It's not a language wide thing.
verbs are function calls, there is no translation layer.
some verbs have default params, some verbs have overloads, some of those overloads allow script actions as a param, but many don't.
If script action as a param isn't mentioned in the verb description it probably doesn't accept one. Those cases you call prior and then cast, then call the verb and the cast sticks the value on the end of the param_list.
 

crossfader accepts a parameter as text, decimal or percentage.
Where I am stuck is converting a variable using get_var to something that crossfader understands.

Q: is there a document I can reference for these verbs ?

The VERBS pdf is nice for a text description, but isn't a language definition for overloads, etc.

BTW, thank you so much for offering your expertise here.
I can't find this expertise anywhere out on the internet like it is presented here.
 

Beer donations are accepted :)
The documentation
https://www.virtualdj.com/wiki/VDJscript.html
that's it, some verbs are under documented like get_date which I covered in an earlier topic, or how get_time can get cue or loopIn/Out times [obscure use, mostly superseded, the description in app is already long enough]
But really all the info is there just super concise.

See examples of param_cast
set a 2 & get_var a & param_cast & set b & var_list
 

I am trying to combine the cue loop , loop roll and play sync options such that if i push and hold a cue point,it will play from the cue point but loop roll or stutter according to selected loop parameters and then will play_sync with the master deck when released. So it will behave like how the pad_scratch buttons behave when pressed. I will also like to think of this as a pad_roll ,similar to what the roll effect does except that this starts a track, "rolls" or loops it, then play_sync to master deck. How do i go about this please. I have tried several combinations and nothing seems to be working.
 

down ? hot_cue 2 & get_loop & param_cast & loop_roll : effect_active 'loop roll' off & sync


something along the lines of this.
 

Any luck in finding out how to do this:

Set '%Fader' 0.0
crossfader %Fader
 

I have a working kludge:

set '%Dst' 1 &
set '%Fader' 0.0 &

(var_smaller "%Fader" 0.6 ?
crossfader 0.0 &
:
crossfader 1.0) &

set_deck `get_var %Dst` &
select &
stop & stop &
play

 

bgavin wrote :
Any luck in finding out how to do this:

I told you
locoDog wrote :
See examples of param_cast


 

Q: How does one code the end of an If-Then-Else block?

pseudo code:
if '$sngFader' = 0.500 Then
deck 1 select
else
deck 2 select
end if


VDJ script:
var_equal '$sngFader' 0.500 ? deck 1 select : deck 3 select

& var_list

var_list only executes in the ELSE block of the structure.

Brackets () don't work here.
I can't figure out how to end the conditional statement and continue on.

 

97%