Accesso rapido:  

Forum: General Discussion

Topic: Script School - Page: 25.2
Yes I'm using a Mac. So you mean it is what it is?
 

Inviato Sat 26 Mar 22 @ 9:20 pm
locoDogPRO InfinityModeratorMember since 2013
no, just needs a bit more thought and not quite as configurable.

effect_slider 'noise' 1 20% && effect_slider 'noise' 2 20% && down ? effect_active 'noise' 1 && repeat_start 'noiseSweep' 300ms & effect_slider 'noise' 1 +1% & effect_slider 'noise' 2 +3% & effect_slider 'noise' 1 50% ? effect_active 'noise' 0 & repeat_stop 'noiseSweep' : : effect_active 'noise' 0 & repeat_stop 'noiseSweep'
 

Inviato Sat 26 Mar 22 @ 9:39 pm
You are fantastic! Thanks
 

Inviato Sat 26 Mar 22 @ 10:50 pm
locoDogPRO InfinityModeratorMember since 2013
PUBLIC BUILD 6878 (2022-03-27)

A quick run down of what's been added script wise over the past month or so, a few things that won't need much explanation and one or two that will.

In reverse chronological order
-sideview_sort, in app the script definition hasn't been added just yet [I just used browser_sort for the on site verbs page] so
sideview_sort "bpm" - toggle bpm sort of sideview ascending/descending
sideview_sort "+bpm" - bpm sort of sideview ascending
sideview_sort "-bpm" - bpm sort of sideview descending


-file_count "karaoke", file_count "sideview", file_count "automix" and file_count "files" to get file count of different lists,
more a script tweak to file_count verb than a new thing but this will be useful in a small way if you want to pull a random file from a sideview, knowing the file count is pretty vital for that type of thing, if you think of something share your thoughts. Pretty meta but good to have than have not.

-invert_controllers can be queried to get the next deck
I'm honestly not sure, I'll have a test on this and edit this bit.

-Allow ONINIT for simple midi controller.
nice to have finally if you're rocking a non defined device.

the more exciting ones
this one has been on the wish list a long time.

-cue_action added to set script of a hot cue,
place action poi instantly :)
cue_action X "SCRIPT"
any script you want, obviously it can't do scripts that action poi don't do like; up ? down ? double_click ? holding ? repeat ?
plus remember your script will be contained in a set of " or ' so you can't use every trick but for such cases there are other ways. [my autohackKey method still has uses if you're on windows]

A more complicated one now, this still has my brain itching... there's something that this next function will allow us to do, but I can't think what it is yet, but it feels like there's something important.
bear with me

-cue_ actions can also index action, loop and load points ("cue_name 1 action", "cue_name 1 loop", "cue_name 1 load" )
...um yeah had me confused,
think of this; cue 1 is a normal hotcue, cue 2 is a action poi
script hot_cue 1 will call cue 1, nothing strange there, but
script hot_cue 1 action will call the first action cue [so cue 2]

it has a use as a get type action also, say you name a pad
`cue_name 1 action`
it will get the name of the first action poi
or
`cue_action 1 action`
it will get the action of the first action poi

I can't shake the feeling that this is super useful but I'm not sure how yet, [I'll get drunk and think about it asap XD]
 

Inviato Sun 27 Mar 22 @ 4:42 pm
I need a couple scripts. The first is to have VDJ automatically scan certain folders when started, for new or moved files.
The second one is so the only files used are in those folders. Example: My DJ library reside in a folder named TLS Library on my G: drive and in another Folder on my H: Drive named TLS_Crates. If these are the only folders I want VDJ to seek for music. Ive ignored the other drives. But I only want VDJ database to use those 2 folders.
 

Inviato Thu 31 Mar 22 @ 8:08 pm
locoDogPRO InfinityModeratorMember since 2013
Second one sounds like a quick filter job.

Match Any condition
file path contains TLS Library
file path contains TLS_Crates

first one is more involved with a virtual folder you recurse, inside that virtual folder you make favourite folders for your watched folders.
 

Inviato Thu 31 Mar 22 @ 11:04 pm
help fix macro:
saved_loop 16 & eq_low -80% & $deck effect_active 'reverb' & eq_low -80%

It should work like this: activate the saved cycle 16, low frequencies -80% and mid frequencies -80% and the reverb effect is enabled.

if you write: leftdeck effect_active 'reverb', then everything works, and if the track is loaded on the right deck, it does not work. how to make a script so that VDJ understands on which soundboard this track is loaded.
 

Inviato Fri 01 Apr 22 @ 7:11 am
locoDogPRO InfinityModeratorMember since 2013
saved_loop 16 & eq_low -80% & effect_active 'reverb' & eq_low -80%
 

Inviato Fri 01 Apr 22 @ 7:33 am
Thanks for the quick response. LOCODOG, do you think, can create a new thread in the forum "User scripts and their description" so that users can share their developed scripts. Without discussion and questions, just a script and a description - what does this script do if you register it on a certain button or slider.
 

Inviato Fri 01 Apr 22 @ 10:20 am
locoDogPRO InfinityModeratorMember since 2013
We had a page for that but it kind of got filled with inaccurate stuff that was confusing more than helpful. so it was locked
however I can update that page still, so just post here, if it's straight forward, I'll remove the post from this thread and I'll post in to the depot

http://www.virtualdj.com/wiki/VDJScript%20Examples
 

Inviato Fri 01 Apr 22 @ 10:42 am
You need a certain form to demonstrate your script, so that all users use the same form of description of their script.
for example , this form:

the name of the device on which the script is written is a BUTTON / SLIDER / HANDLE / JOGSHUTTLE or LED.

Description: (a detailed description of what will happen to the controllers if you activate this script).

Script text:

Decryption of the script:
----------------------------------------------------------------------------------------------------------------------

full form example:

BUTTON

Description: If you hold down the shift key on your controller and press the play button, then the track that is playing on this deck is cloned to the opposite deck.

Script text: var "$shift" ? clone_deck : play_pause

Decryption of the script: if you hold shift and press play, the track is cloned: otherwise (without holding shift) the button will work as play_pause.
-------------------------------------------------------------------
Naturally, this forum needs a good moderator, such as LOCODOG, who, even with his eyes closed, can see the flaws in the scripts.
 

Inviato Fri 01 Apr 22 @ 1:44 pm
skyzo76PRO InfinityMember since 2016
Hello,
I have a problem with this : before I use Diy controller with script inside "device" and it separate slider volume deck 1 and slider volume deck 2.SO i use a variable that I call "bothfader" to sometimes assign some decks on 1 volume fader, ex one fader for deck 1/2 and sampler and with this variable i can switch easily between some settings...BUT now, I work with a reloop ELITE and the slider for the volume are the same assignement (midi)for deck1 or deck2 so when you want to script a specific code for the slider 1 and deck 1 (exemple) it will do it on the other slider too...because there both called volume, is there a way to separate the settings of those slider (because i do not have the .xml of the "device") i guess I must find a variable for a specific deck ???
 

Inviato Mon 18 Apr 22 @ 10:07 am
locoDogPRO InfinityModeratorMember since 2013
action_deck X ?
or
device_side X ? for these types of cases
 

Inviato Mon 18 Apr 22 @ 10:19 am
skyzo76PRO InfinityMember since 2016
thanks locodog for the respons! yes it works when "fake fader" are disabled but if I want to keep the fake fader eq etc..it dont work...i don't know if i am wrong but when all "fake" are able (not disable) sound is better.
 

Inviato Mon 18 Apr 22 @ 7:28 pm
locoDogPRO InfinityModeratorMember since 2013
show me your script
 

Inviato Mon 18 Apr 22 @ 8:18 pm
skyzo76PRO InfinityMember since 2016
hello locodog/
here is the test of my script...so on the "skin" for those code, everything works fine but have no impact on "output" so it doesn't affect the output volume but we see slider moovin on the skin..

action_deck 1 ? deck 1 volume : action_deck 2 ? deck 2 volume
OR
action_deck 1 ? var "$BothFader" 1 ? deck 1 volume & deck 2 volume : deck 1 volume : action_deck 2 ? deck 2 volume

when I add a fake mixer off , everything is good (but Im afraid to loose the "fake mixer" avantage)
action_deck 1 ? fake_mixer off & var "$BothFader" 1 ? deck 1 volume & deck 2 volume : deck 1 volume : action_deck 2 ? fake_mixer off & deck 2 volume

(I find that fake mixer off (on the ONINIT command) affect the quality of the cross fader but I didn't test it for a long time)..
 

Inviato Sat 23 Apr 22 @ 7:47 am
locoDogPRO InfinityModeratorMember since 2013

BRACKETS IN SCRIPT


So huge it gets a title box...
BUILD 6920

Oh boy, this doesn't quite tear up the rule book, [because the old rules still work] but it comes close, maybe takes the old rule book and puts it on a high shelf out of the way, because we have another newer rule book and it's way better , it changes a lot of ways of doing things.

Play along at home, do these simple examples and after a few you won't need to really think how to do them you'll just know [and be ready for something else]

We'll start with the old way with a simple example of nested queries

So we have a button, if deck 1 is playing do nothing, if not playing play deck 3,
deck 1 play ? nothing : deck 3 play

but aside from that, we also want if deck 2 is playing do nothing, if not playing play deck 4,
deck 2 play ? nothing : deck 4 play


so combining those we have to write it like this
deck 1 play ? nothing & deck 2 play ? nothing : deck 4 play : deck 3 play & deck 2 play ? nothing : deck 4 play

hard enough for some to understand but I hope you can read what is happening there.

So the new method with brackets
( deck 1 play ? nothing : deck 3 play ) & (deck 2 play ? nothing : deck 4 play )

now I guess that got a whole lot easier to understand what's happening.

This alone is huge, I have a script right now and it needs to check 6 things, so the old way to do it right [cover every possibility] took 63 queries, that was 11,000 chars of script.
[and very close to my limit of too annoying to work with]
the new method, just needs 6 queries, it cut the script down to like 1600 chars [it sounds a lot but it really isn't]

but wait, there's more. && query
a different example, let's say; if deck 1 is playing & deck 2 is playing ? yes both decks are playing then play deck 3 : it is not true both decks are playing, do nothing.

old method
deck 1 play ? deck 2 play ? deck 3 play : nothing : nothing

easy enough but

brackets method
( deck 1 play && deck 2 play ) ? deck 3 play : nothing

the && is important, it's like if both of these are true, return true/1 to the query, if one or both are false return false/0 to the query.

this above is query side brackets, it could be called a && query or a AND query, [&& or AND are name for common logic gate in digital electronics ]
it was sort of possible before with this
param_equal `deck 1 play && deck 2 play` 1 ? deck 3 play : nothing

same kind of thing, if both evaluate as true it returns true/1 to param_equal, if so, does 1 = 1 ? yes, deck 3 play , if it doesn't return true/1 to param_equal then does 0 = 1 ? nope, do nothing.
there is also another similar old way but it's even move typing and even more confusing so I won't mention it further as it was never a good way.

3rd awesome thing brackets do, relates to script deck focus, something I should have prattled on about before but forgot. It's a bigger script thing. [and it used to be really problematic]

consider a custom_button on deck 1, if we gave it this script
play

we press it and deck 1 plays, it knows it's a deck 1 button
now what if we had this as a deck 1 custom button

play & deck 2 play & effect_active 'echo'

both decks play, but it's deck 2 that gets the echo, because the script deck focus was moved to deck 2 with "deck 2 play", until another deck is specified it will act all commands on the last called deck.[last called in the script]

now look at these [still deck 1 custom button]
play & ( deck 2 play ) & effect_active 'echo'


now look at this [still deck 1 custom button]
( deck 2 play ) & play & effect_active 'echo'

these cases it's deck 1 that gets the echo, the script deck focus to deck 2 is contained in the brackets.

now try this,
( deck 2 play & effect_active 'distortion' ) & play & effect_active 'echo'

deck 2 gets distortion, deck 1 gets echo
now you might be thinking, "that's not that good, you could just rearrange the script to get the same result, And you're right. But this is only a simple explanation, bigger scripts that act on several decks this is a big pain saver.


This one next is 50:50, it probably more 90:10, It's not a feature or ability, it's just how it works, I think the devs made the right decision, but it still could be "ummm not sure" how it will work just by reading it the first time.
Read this what do you think should happen?
( wait 8bt & effect_active 1) & ( effect_active 2 )

before I knew, during testing I was 90% sure we would get
effect_active on slot 2 instantly & effect_active on slot 1 after a 8 beat wait and that's what we get. [the "wait" is contained in brackets]

Final thing, the more curious of you might be asking "can brackets in brackets?" and the answer is YES they can!,
this isn't a sensible example just the first one I thought up to prove the concept
deck 1 level 1.0 & deck 2 level 1.0 & deck 3 level 1.0 & wait 2000ms & ( deck 1 play ? ( deck 2 play ) & level 0.5 : (deck 3 play ) & level 0.0 ) & level 0.75


Quiz time, deck 1 is currently playing, you press this button above, what level is deck 1, level is deck 2, level is deck 3, what other deck starts playing because of this button press?

Answers
If you get this, you get all of it.

I need to go back and see what topics need updating now.
 

Inviato Fri 29 Apr 22 @ 8:16 am
locoDogPRO InfinityModeratorMember since 2013
the above was huge but that's not everything for this month, a good few script changes & a new verb [ooooh shiny]

-var_equal, var_greater and var_smaller support script as second parameter
not quite worthy of a title box but now these var_* scripts can compare vars against things and not just other vars. And why not, it'll be nice to use them more.

-search_playlists can accept script parameter, search script parameter passes deck correctly

so
search_playlists deck

deck here is literal not a stand in, 4 letters, d e c k,
the script will search for the playlists that hold the track on deck

plus it can also accept a script as a param to say maybe search playlists of what you're looking at in the browser. [example coming] [code][/code]

-goto_cue +1 also cycles through cues with other types than cue
not a new script thing but it deserves mention, previously goto_cue +1 would miss hotcues that are beat anchors, but stop would cycle them.
So yes little poi you can be a beat anchor and a hotcue and we'll just accept you as you are. Now be happy.

-browser_gotofolder can accept script parameter.
Cool cool cool makes navigation that bit easier.

-add get_browsed_folder_path
Shiny new verb, 3 people all asked the same sort of question in a few days needing the full path of what is being looked at in the folder list, the devs thought it would be handy to have too.

-Support "quick_filter 1 on" and "quick_filter 1 off" script
explicitly switch quick filters on / off - marvellous

That's all the script stuff added in the last month.
Added in, in a just month, no huge song and dance, get places, search for stuff, filter stuff, compare stuff, continual improvement.
 

Inviato Fri 29 Apr 22 @ 9:29 am
locoDogPRO InfinityModeratorMember since 2013
 
repeat_start 'strobe' ? on & cycle strobe 4 : off & cycle strobe 4 & repeat_start 'strobe' 25ms -1 &
( var strobe 1 ? param_smaller 'get_beat_bar 4' 0.5 ? set strT 0 : set strT 1 :
var strobe 2 ? param_smaller 'get_beat_bar 2' 0.5 ? set strT 0 : set strT 1 :
var strobe 3 ? param_smaller 'get_beat_bar 1' 0.5 ? set strT 0 : set strT 1 :
var strobe 0 ? repeat_stop 'strobe' & set strT 0 : ) &
var strT 0 ? effect_active negative off : effect_active negative on :



Practical example of brackets in scripts, previously where we
set strT 1
we'd have to write
effect_active negative on

likewise with set strT 0 & effect_active negative off,
not a massive saving in this example but goes a long way for readability.
 

Inviato Fri 29 Apr 22 @ 10:58 am
Hi all,

I made a few buttons that seem to be performing well (at least in the situation I'm using them for) and I'd like to post this one first:

This is a standalone custom button for those who don't use their mixing console hardware very much. What it generally does is it mixes the left source or right source after dropping loop timing then uses a lower volume explosion. This most likely is not made for mixing experts and users who mainly use their hardware. I designed it for myself who mostly do outdoor mobile parties where my mixing board is slid inside my roadcase to protect it from the outdoor elements. With that being said I use automix most of the time and this button will probably make it easier for me to do an alternative automix during dance segments.

For best effect the first cue point is best set for the next song ahead of time. It's more geared to dance music with a decent beat.

Instructions:
1) Set cue point 1 to a point in the upcoming song where a beat is happening (Let's say that is song B)
2) On the opposite deck with song A playing, click the button with the below code which will end the current song A and start song B.

CrossFade MixExplode
crossfader 0% ? 
deck left select &
deck right hot_cue 1 & deck right play & sync & auto_crossfade 50% &
deck left select &
effect_active "flanger" on &
loop 2 &
wait 3bt &
loop 1 &
wait 3bt &
loop 0.5 &
wait 2bt &
loop 0.25 &
wait 1bt &
loop 0.125 &
wait 1bt &
sampler_volume_master 50% &
sampler_bank 1 &
sampler_play_stop 3 &
sampler_volume_master 50% &
deck left select &
effect_active "flanger" off &
deck left play_pause &
deck left loop 8 &
auto_crossfade 100% &
deck right select :
deck right select &
deck left hot_cue 1 & deck left play & sync & auto_crossfade 50% &
deck right select &
effect_active "flanger" on &
loop 2 &
wait 3bt &
loop 1 &
wait 3bt &
loop 0.5 &
wait 2bt &
loop 0.25 &
wait 1bt &
loop 0.125 &
wait 1bt &
sampler_volume_master 50% &
sampler_bank 1 &
sampler_play_stop 3 &
sampler_volume_master 50% &
deck right select &
effect_active "flanger" off &
play_pause &
deck right loop 8 &
auto_crossfade 0% &
deck left select


Note that it does set the previous song to a loop 8 which can be removed in the code. I might change that on my live gig in the future but right now my thought is that I might want to return to the same loop again after playing the new song.
 

Inviato Tue 07 Jun 22 @ 12:52 am
54%