Quick Sign In:  

Forum: General Discussion

Topic: Script School - Page: 40.55
locoDogPRO InfinityModeratorMember since 2013
Working It Out


beataddict wrote :
Is it possible to query a specific Cue position like we do with Song position ?


Seems a question worthy of a lesson
Let's work this one out, cue_pos indeed looks like the thing we'll use

list of verbs wrote :
"cue_pos 1" returns the position of cue point #1 as a percentage "cue_pos 1 msec", "cue_pos 1 sec", "cue_pos 1 min" returns the position of cue point #1, msec, sec and min parts "cue_pos 1 mseconly" returns the position of cue point #1 in milliseconds "cue_pos 1 beats" returns the position of the cue point in number of beats from first beat


put this as a custom_button name, it will show you what it returns
`cue_pos 1`

it returns a percentage..., song_pos returns a percentage too, but that gets messy, 5% of 1 minute is going to give different results to 5% of 2 minutes. So let's not use that.

try this as the custom_button name
`cue_pos 1 mseconly`

cue_pos 1 mseconly that returns milliseconds, BUT One thing about cue_pos is that it returns ABSOLUTE values, it doesn't take pitch into account, we can prove this by moving the pitch slider around and our custom_button name stays the same,
That's going to mess us up too, a few hundred ms this way or that way might not matter but we can do better, cue_pos 1 beats, seems best

Let's look at getting our beat position
in the script window since we want to get something a good idea is type

get_
lot of verbs in that list, let's narrow it down
get_beat
still a few to chose from, looking at each description
get_beatpos is what we want.

Ok now we're comparing apples to apples, how are we comparing

Thinking out loud
if get_beatpos is bigger than (cue_pos beats - 16) [ 16 beats before]

That as script
get_beatpos & param_bigger 'cue_pos 1 beats & param_add -16' ?

Also thinking out loud
but also get_beatpos is smaller than cue_pos beats

That as script
get_beatpos & param_smaller 'cue_pos 1 beats' ?

put them together

get_beatpos & param_bigger 'cue_pos 1 beats & param_add -16' ? get_beatpos & param_smaller 'cue_pos 1 beats' ? on : off : off

put it on a custom_button and move the playhead around to test the LED logic.
It works!

There are other ways to do the compare but they take more typing, but if you were being fussy to only have 1 question mark [more advanced]

param_equal `get_beatpos & param_bigger 'cue_pos 1 beats & param_add -16' && get_beatpos & param_smaller 'cue_pos 1 beats'` 1 ? on : off

what does the bit before the && evaluate as, and what does the bit after && evaluate as, if both are the same, [and this case only both being true is possible for them to be the same] then the stuff inside the ` ` will return true, aka 1

Another way, over complicated for this case, more for queries of some of a few

param_equal `param_add "get_beatpos & param_bigger 'cue_pos 1 beats & param_add -16'" "get_beatpos & param_smaller 'cue_pos 1 beats'"` 2 ? on : off
 

Posted Thu 12 Oct 23 @ 4:31 am
Wow that was so much help, thank you !

I ended up having to add another " : " at the end to make that work on my DDJ-RZX Cue pad the way I wanted it. For my workflow, I only want a visual reminder when my Cue #7 is getting close (16 bt is fine). The way it's now set up, the pad color is steady lit with the cue default color, but flashed black -16 beats before it is reached. Yeah !

get_beatpos & param_bigger "cue_pos 7 beats & param_add -16" ? get_beatpos & param_smaller "cue_pos 7 beats" ? blink 500ms ? color "black" : cue_color 7 : cue_color 7 : cue_color 7


Thank you so much for your help :-)
 

Posted Thu 12 Oct 23 @ 3:25 pm
locoDogPRO InfinityModeratorMember since 2013
No problem, it just seemed like one of those were the full thinking process could be spelled out.
The figuring it out from documentation and not getting hung up on every verb or nested queries.

I've added it in to the page 1 of links in this thread just after doing bigger smaller comparisons [~800 post difference in time, but as topics go they follow each other quite well.]
 

Posted Thu 12 Oct 23 @ 3:54 pm
locoDogPRO InfinityModeratorMember since 2013
Well another EA release dropped and I'm behind on reporting the additions so I guess I'll work backwards, some points might get their own topic in future

BUILD 7716 (2023-10-16)

-"effect_disable_all mic", "effect_disable_all aux" and "effect_disable_all sampler" scripts added
-"scratchbank_load" without parameters opens a menu to select the bank
-scratchbank_load accepts absolute index or name as parameter as well
-loop_move allows moving loop up to 30 seconds before start or after end of song

Pretty straight forward there, loop_move has been a long time in waiting, scratchbank_load stuff is because of me recently deep diving into scratchbanks [3 years late, 2020 was a blur] and the devs thought my suggestions weren't terrible.

I never discussed effect_disable_all, [and I use it all the time] neither did I get in the single fx slots for mic, sampler, aux, [not often I use them, I just set and forget on the sampler.] I'll maybe ad something somewhere, but they do what it says on the tin.

moving on

Stuff from a little earlier.

set_deck vdjscript to execute script on deck based on another script. The use case for this will have me prattling on for ages. It's a easy script you'd use for complicated scenarios, A quick easy case would be doing stuff across several decks, it's able to pick a deck to be the script default.
I'll do a post on this one, because if you start getting complicated it's useful.

get_automix_song supports column names "artist_before_feat", "feat_after_artist", "title_before_remix" and "remix_after_title"

something mainly for video skin making, automix list has same formatting options the loaded song does.
Also for the skin makers
-sampler_drop, sampler_loop and sampler_mic available as sysicon for skins.
defaultIcons page updated. i1 - 3 if you're interested.


Add 'Full Path' database field for use in scripts.
it's not a real database field, it's a mashup between get_loaded_song "drive" & get_loaded_song "file path". To actually get a real navigable path you had to mash the two together, then still add in a check for online sources.
Now there's "full path" so the old way still works but the new way is cleaner.


-Filter folders can use `` to include script as values to compare to
script in filters, worth it's own topic, you can now get some value from a track and use it in a filter.
I think I'll demo a circle of 5ths filter.

I think that's everything.
 

Posted Mon 16 Oct 23 @ 5:40 am
mg_1978PRO InfinityMember since 2008
Hi at all: is there a script like virtualfolder_add ‘my_folder’? Because this script add a track focused only if folder ‘my_folder’ is a playlist or sampler_bank….if my_folder is a normal folder in my pc? I could add a track with script?
Thanks a lot
 

Posted Mon 23 Oct 23 @ 10:21 am
locoDogPRO InfinityModeratorMember since 2013
Nope, you can't move files around with script, you can place references like how playlists and virtual folders work, but you can't move actual file locations with script.
You could with a plugin.
 

Posted Mon 23 Oct 23 @ 10:30 am
Thanks everyone for your help so far. I've mapped shift and EQ to to change EQ frequency for low mid high. Using ez remix on the pro skin. However when I adjust it, it didn't show the EQ panel I'm adjusting it. What script do I need to add to momentarily show the EQ panel whilst adjusting it, and then to revert back to the EZremix EQ panel?
 

Posted Fri 27 Oct 23 @ 9:01 am
locoDogPRO InfinityModeratorMember since 2013
YOUR THING & setting eqMode "Frequency" ? : set_var $myEQMode `setting eqMode` & setting eqMode "Frequency" & repeat_start eqRevert 1000ms 1 & get_var $myEQMode & param_cast & setting eqMode
 

Posted Fri 27 Oct 23 @ 1:51 pm
"Hello, beloved DJ software users! Can you tell me how to make the pad blink in different colors? The function is assigned to pad №1: var “$shift” ? effect_stems ‘kick’ : effect_stems ‘vocal’. With pad №1, I turn on FX:Kick+Vocal and I need the pad to light up alternately in red and blue when this double FX stem is turned on. If I turn on only FX:Vocal, then the pad lights up blue, if I turn on FX:Kick, then the pad lights up red, if FX:Kick+Vocal, then the pad should blink alternately blue and red, when FX: is off, then the LED is gray.

I wrote such a script, but with errors: effect_stems ‘kick’ ? blink 600ms ? color ‘red’ & effect_stems ‘vocal’ ? blink 600ms ? color ‘blue’ : effect_stems_color

Please correct my script.
 

Posted Sun 29 Oct 23 @ 10:02 pm
One possible solution for the color, could be:
effect_stems 'kick' ? effect_stems 'vocal' ? blink 600ms ? color 'red' : color 'blue' : color 'red' : effect_stems 'vocal' ? color 'blue' : color 'gray'

where the last color is to your choosing. gray or black (off) or .. for the pad color when its NOT Kick or Vocal.

Not tested.

PS
I prefer when creating a blinking pad.. to also change the intensity also during the blink, so maybe the blink part of the script becomes:
blink 600ms ? color 'darkred' : color 'blue'

if one's LEDs allow for that.
 

Posted Mon 30 Oct 23 @ 2:32 am
locoDogPRO InfinityModeratorMember since 2013
I don't know what browser ElementDJ is using but the stylised ‘ “ are not compatible within the script engine.
@IIDEEJAYII I fixed the code block in your reply
 

Posted Mon 30 Oct 23 @ 5:16 am
Thanks Locodog.. great catch :)

I copied and pasted from OP script.. (not tested)
(and now don't see the stylized single quote in the OP)



 

Posted Mon 30 Oct 23 @ 6:34 am
@Locodog

Could you elaborate on this as it sounds like it could be interesting:

-Filter folders can use `` to include script as values to compare to
script in filters, worth it's own topic, you can now get some value from a track and use it in a filter.
I think I'll demo a circle of 5ths filter.
 

Posted Mon 30 Oct 23 @ 11:34 am
locoDogPRO InfinityModeratorMember since 2013
@DJPhallus when I feel upto it, I've had a few interactions recently, one really positive and several others that treat me like I'm gpt.
The difference left me feeling pretty sour.

unrelated a bit of housekeeping - remembered an old short post I didn't link in the index; Appending a tag
 

Posted Fri 03 Nov 23 @ 6:24 pm
locoDogPRO InfinityModeratorMember since 2013
Script in filters


Quick fire examples, want to use script as a value, just wrap the script in ` `

Artist contains `deck master get_artist` FIND MORE BY CURRENT ARTIST
Bpm > `deck master get_bpm & param_multiply 0.48` and Bpm < `deck master get_bpm & param_multiply 0.52` ~0.5* BPM MATCH
key is `deck master get_key` EXACT KEY MATCH
key is `deck master get_harmonic` EXACT KEY MATCH [vdj figures out key from harmonic]

All very straight forward, lets do something interesting

A circle of 5ths, AKA +1 on the Camelot wheel, AKA harmonic

First we'll do the "I hate myself method" in steps

key is `deck master get_harmonic & param_equals "01A" ? get_text "02A" : `

if harmonic is 01A then +1 is 02A, because we're inside ` ` the filter is given what the script inside evaluates to, so get_text the value you want.

So go nuts, there's only 24 possibilities

key is `deck master get_harmonic & param_equals "01A" ? get_text "02A" : deck master get_harmonic & param_equals "02A" ? get_text "03A" : ...`


do that for 01-12 for A and carry on for 01-12 B and that's it, it's ugly but it works.
If you do it like that you'll get bored by your 6th copy paste, hopefully bored enough to think "there has to be a better way"

So a better way then,
how do we add 1 to the harmonic and for the case of 12X loop round to 1? we best try some stuff, [play along at home because I'm not going to give you the final filter]
load up a track with any key and open your custom_button editor, use this as the name
`get_harmonic`
that gives our current harmonic, not what we want yet, try adding 1

`get_harmonic & param_add 1`
same result, that doesn't work, try the other way of adding

`param_add get_harmonic 1`
different result, wrong answer, it's put a 1 in front of our harmonic
it was understood as a string, let's try cast it as an integer then add 1

`get_harmonic & param_cast 'integer' & param_add 1`
well we added 1 but a few issues, and this depends on you starting harmonic as to what you see
first off obvious, we're missing the A or B
now if your starting harmonic was 09X, 10X or 11X that's the only issue you'll see
but if it was less than 09X you'll see you lost your leading zero. or if your start harmonic was 12X you now have 13

let's deal with the leading zero, param_cast '00' will cast a number with a fixed number of digits

`get_harmonic & param_cast 'integer' & param_add 1 & param_cast '00'`
that fixes our leading zeros issue, now to try add A or B with a query on the end

`get_harmonic & param_cast 'integer' & param_add 1 & param_cast '00' & get_harmonic & param_contains "A" ? param_add "A" : param_add "B"`
that doesn't work, go back a step can we actually add a letter to it, forget the query just try add a letter on the end

`get_harmonic & param_cast 'integer' & param_add 1 & param_cast '00' & param_add "P"`
we got an P there, must be the query at fault, let's try the query at the start and double up the script, one for A case one for B case

`get_harmonic & param_contains "A" ? get_harmonic & param_cast 'integer' & param_add 1 & param_cast '00' & param_add "A" : get_harmonic & param_contains "B" ? get_harmonic & param_cast 'integer' & param_add 1 & param_cast '00' & param_add "B"`
That works, now just the issue of starting with harmonic 12X gives 13X
this is where I'm not going to give you a copy paste

if we know get_harmonic & param_contains "A" ? is true, the only thing we need to know after that is get_harmonic & param_contains "12" ? if that's true we want 01A, and I already covered that in the long boring method, : if it's false then do the other stuff.
we've got to ask the same contains 12 question after get_harmonic & param_contains "B" ? as well, but that's all there is to it.

if you've done that right your custom_button name will be == starting harmonic +1
that custom button name is what you paste into a filter that starts

key is

one tiny difference though, custom_buttons know what deck they belong to, filters follow the selected deck unless told otherwise, so when you paste it in to the filter, just after the opening ` specify deck master just before the first get_harmonic

I've told you everything here except the answer explicitly, the whole jigsaw is built up into only a couple of separate pieces, just put them together, or use the horrible way.

Or if time is money for you, I can work on those terms too.

[wow that got lengthy, but to do scripting you have to put some effort in, there won't always be a copy paste solution given]
 

Posted Sun 05 Nov 23 @ 1:59 am
Hey yall, my name is Big King Zilla, I just started DJing on Twitch because I figured out how to DJ using virtual DJ with my wheelchair. I am physically disabled so it pretty awsome but im trying to figure out how to do some more complex scripts for the custom buttons for better transitions that are a little more elaborate not to simple. Right now I am trying to figure out how to eq_kill_low & filter 25% & effect_active 'reverb' & mix_now 16bt but I cant get the effects to turn off automatically after I transition . If anybody can help me out I would really appreciate it.
 

Posted Sat 11 Nov 23 @ 7:17 am
locoDogPRO InfinityModeratorMember since 2013
using a wait 16bt & then calling effect_active off would be easiest.
 

Posted Sat 11 Nov 23 @ 7:31 am
mg_1978PRO InfinityMember since 2008
hi at all, i have this question: i have a playlist named “Sequencer” (in browser i have seen that is a file.m3u) and this is my script:
get_browsed_folder_path & param_cast & param_contains ‘Sequencer’ ? browser_remove : playlist_add
because only in Playlist Sequencer (or folder Sequencer?) i would remove songs…in other folders i would add songs in Automix..doesn’t work (i think problem is that “Sequencer” isn’t a folder, but is a Playlist
Can you help me with correct script? Thanks
 

Posted Sun 12 Nov 23 @ 6:45 pm
locoDogPRO InfinityModeratorMember since 2013
check with a custom_button LED logic

get_browsed_folder_path & param_cast & param_contains 'Sequencer' ? on : off

does it work there? also check capitalisation, also check your ' marks, vdj does not like curved ' " like you have typed here.
 

Posted Sun 12 Nov 23 @ 7:47 pm
mg_1978PRO InfinityMember since 2008
yes, correct thanks! my ‘ wasn’t right, now it works

 

Posted Sun 12 Nov 23 @ 11:43 pm
90%