Quick Sign In:  

Forum: Old versions

Topic: advanced scritp advices....

This topic is old and might contain outdated or incorrect information.

jaakkoPRO InfinityMember since 2006
Hello, I got some advanced script questions....

1) Is there a way to remember old value of a slider? For example, if I press button down, slider value will go to zero and then when released, go back to old value (or there where I have set the slider on my controller (fake value or something)).

2) is it possible to test if a video/audio crossfader is more on the left side than the right side?

3) Is it possible to check if certain deck is audible on master? At least in some situations VDJ can ask that "are you sure to do X, the deck is playing" But is there a script test for it?

4) Is there a way to say " a ? b1 & c & d : b2 & c & d" in a shorter way, like "(a ? b1 : b2) & c & d" if you understand what I mean....
 

Posted Mon 01 Dec 14 @ 9:05 am
1) Only way to achieve this is to use "while_pressed" on your command: "deck 1 filter 20% while_pressed"

2) param_smaller video_crossfader 50% ? (video crossfader is towards left deck) : (video crossfader is towards right deck)

3) Queries can be messy. I would use c & d & a ? b1 : b2 (In other words I would use the query on last part of my script)
Please remember that once a query evaluates as true it executes the assigned action and it won't keep evaluating further down the code you use in case the evaluation appears again. That's a common mistake people do on complex queries ;)
 

Posted Mon 01 Dec 14 @ 10:04 am
locoDogPRO InfinityModeratorMember since 2013
Hi jaakko, I can see you're into working out the technical stuff so I'll share this idea with you.

Here's something I've been playing with, Sometimes while_pressed won't cut it for complicated scripts, Sometimes you need to remember a value, imagine you have a really long script to make 2 decks the same level (useful for cloning)
deck 1 clone_deck 3 & set '$varD1Level' '`deck 1 level' & deck 3 level 100% & {set '$varD3Level' '`deck 3 level' & var_smaller '$varD3Level' '$varD1Level' ? nothing : deck 3 level -1% & set '$varD3Level' '`deck 3 level' & var_smaller '$varD3Level' '$varD1Level' ? nothing :} *repeat the script in parentheses *100
(written fully this will work)

I hope you can see how such a long script can take the levels of 2 decks make them variables, compare the variables against each other, if D3 isn't lower than D1, deck 3 level is reduced by 1% , D3 is then set to the new level and checked again repeating the process until D3 is smaller than D1 ( at most by 1%)

All very long and boring and impractical to write in to lots of scripts but take this bit of the script and put it on a custom button (you can just invent custom buttons, like so " custom_button_edit 50 " ,So this bit on custom button 50
set '$varD1Level' '`deck 1 level' & deck 3 level 100% & {set '$varD3Level' '`deck 3 level' & var_smaller '$varD3Level' '$varD1Level' ? nothing : deck 3 level -1% & set '$varD3Level' '`deck 3 level' & var_smaller '$varD3Level' '$varD1Level' ? nothing :} *repeat the script in parentheses *100

And then the script that was huge in your mapper now can look like this
deck 1 clone_deck 3 & custom_button 50

I've really only started playing with this idea, I don't know where it goes but in essence scripts can be multi-threaded, one thing to note custom buttons can't press custom buttons :-(
 

Posted Mon 01 Dec 14 @ 12:38 pm
jaakkoPRO InfinityMember since 2006
Thanks for the answers! Maybe it's too overkill way to preserve the old value like this. But I like the idea of custom buttons, but I just dont know how do I "invent" a custom button. Do i need it on the skin? VDJ default skin has 2 custom buttons on each side, but thats not enough...
 

Posted Wed 03 Dec 14 @ 6:06 am
locoDogPRO InfinityModeratorMember since 2013
I know it looks like over kill but VDJ does it no problem, sometimes the only way to be sure is to nuke the site from orbit. :-)
as for custom buttons It doesn't have to be on screen,

Use 2 keyboard keys like this

custom_button_edit 50 (opens the editor or the list)

custom_button 50 (switches it on)

One more thing, custom buttons can have lots of sub option (left is my list of subs for 1 custom) (red line points to make new sub option)
http://pbrd.co/1BegSY3
 

Posted Wed 03 Dec 14 @ 2:02 pm
jaakkoPRO InfinityMember since 2006
It seems that the deeper I get into script world the more I agree with you locodog :)
If I have 13 buttons mapped and they hae 95% same function(only difference is cuepoint) it's handy to have custom buttons as script snippet placeholder.
Funny thing is that If i name custom button as "name" i cannot call it. Script: "custom_button name" does not work but teh script "custom_button 50" works if I name the button as "50". That is strange. It could be more convenient and readable to use real names instead of numbers. Hmm...?

Also, saving old value to variable is interesting topic. I realized that most of the old values can be returned if you use while_pressed -command. But it does not work with all situations.

I have a situation that i click a fancy button it does nice scripts for me, but after button is released, I lost the focus (select) of the deck. What i need is that the script would remember the previously selected deck and reselects it when button is released.
I tried set '$oldFocus' '`deck 1 select ? deck 1 : deck 2' and set '$oldFocus' '`deck select'
and several others but it seems that if I display var_list, the value of $oldFocus is always 0. Funny thing is that if I use set '$varD1Level' '`deck 1 level'
as you did, it works, the value on var_list is something else than zero. I think there is something with variables that I dont understand?
 

Posted Fri 05 Dec 14 @ 4:23 am
locoDogPRO InfinityModeratorMember since 2013
Names could be very useful, at the moment you can only script custom button by button number and it does whatever sub is on that button at that time, if you could script the number and the name, scripting would be much more useful (for about 20 people in the whole world), but the names would have to be unique (at the moment you can have subs on on the same button with the same name)
So when making a custom, V8 would have to check if the name is unique on that button and warn you if it isn't.

As for your focus switch Maybe try this, (I've only just found this)

set '$oldFocus' '`get_defaultdeck'

you could also do it the long way

deck 1 select ? set '$oldFocus' 1 : deck 2 select ? set '$oldFocus' 2 : deck 3 select ? set '$oldFocus' 3 : deck 4 select ? set '$oldFocus' 4 : nothing

unfortunately (to reverse it) I don't know of a quick way to select a deck from a variable so, it'd have to be a string of queries
var_equal '$oldFocus' 1 ? deck 1 select : var_equal '$oldFocus' 2 ? deck 2 select : var_equal '$oldFocus' 3 ? deck 3 select : var_equal '$oldFocus' 4 ? deck 4 select : nothing
But of course you could put this on custom button 100 (any number) so you'd have

set '$oldFocus' '`get_defaultdeck' & your script & custom_button 100

If V8 could set a script from a variable, like it can set a variable from a script then you wouldn't need 100 queries script like I posted a few days ago.
I can see we may have some interesting conversations in the future.
 

Posted Fri 05 Dec 14 @ 7:25 am


(Old topics and forums are automatically closed)