Forum: General Discussion

About VirtualDJ and DJing in general

If you need extended support, contact our Support Team.
Forum Guidelines  (*) The moderators hold the rights to move or modify posts in order to keep the discussions clear or to facilitate the search.
话题: Script help needed mapping load button
blckjckPRO InfinityMember since 2008
While using automix I'd like to be able to skip to the next song in the list with my LOAD button on my DDJ-RX. I can do this already with the keyboard after mapping the ESC key to automix_next. I spent some time reading in the Script School thread and some other references. I thought I understood the logic. My ultimate goal is to check to see if the deck is playing and automixing. If it is, and I hold the button, then mix to the next song. But, I want the LOAD button to function normally on the deck that is not automixing.

Original Mapping:
var 'hwmixer' ? nothing : holding ? unload : load


If I understand right:
Is the controller in hardware mode on this channel
If yes, do nothing
If no, move on to the next part
Is the button being held
If yes, unload
If no, load


So, first I tried to see if I could do it without holding.
var 'hwmixer' ? nothing : play & automix ? automix_skip : holding ? unload : load


When automix is off, LOAD behaves normally. When automix is on, and I press LOAD on the deck that is actively automixing, the next automix track gets mixed in. But, if I press the LOAD button on a deck that is empty and not playing, it loads the highlighted track from the browser and starts playing it. My guess is I need to add more logic. But, I don't know what to test.

发表时间 Wed 16 Jan 19 @ 3:04 pm
AdionPRO InfinityCTOMember since 2006
& in this case is used to tell vdjscript to do 2 actions, not to tell it to check both sides for the if-part.
So it will do
play
and then
automix ? automix_skip : holding

You should use ? to make it into 2 questions, first checking play, then checking automix

发表时间 Wed 16 Jan 19 @ 3:15 pm
blckjckPRO InfinityMember since 2008
So, I tried this:
var 'hwmixer' ? nothing : play ? automix ? automix_skip : holding ? unload : load

If both play and automix are true on the deck that I press the LOAD button, then it skips to the next song as expected.

Pressing LOAD on another deck does nothing, when it should have loaded a song. Unload also does not work after dragging a song to the deck.
If automix and/or play is not true, then LOAD does nothing on any deck. Also, unload does not work on any deck.

发表时间 Thu 17 Jan 19 @ 4:31 am
AdionPRO InfinityCTOMember since 2006
If you break it down, this is what you have currently, so you are missing what to do if play is not true.
play ?
automix ?
automix_skip :
holding ?
unload :
load

So you probably want to add another ": holding ? unload : load" at the end for the else part of play.

发表时间 Thu 17 Jan 19 @ 4:49 am
blckjckPRO InfinityMember since 2008
That did it. Thank you Adion.
var 'hwmixer' ? nothing : play ? automix ? automix_skip : holding ? unload : load : holding ? unload : load

I have a better understanding now. I should be able to research more to get the statement flow in my head. Breaking it down vertically helps.

var 'hwmixer'
..? nothing
..: play
....? automix
......? automix_skip
......: holding
........? unload
........: load
....: holding
......? unload
......: load


I just don't get yet why I needed to repeat the holding area. I don't see yet where it was trapped in the play?automix area. I thought it would just continue on like it did at the beginning for hwmixer?nothing

发表时间 Thu 17 Jan 19 @ 7:40 pm
locodogPRO InfinityModeratorMember since 2013
Let's go thru it
var 'hwmixer' ? nothing : play ? automix ? automix_skip : holding ? unload : load

HW? true do noting : false, are you playing? true,are you automix on? true, skip : false, are you holding? true, unload : false, load : we haven't had a reply if playing? is false
You were asking if playing? = false, do nothing (no command)
machines can't guess {yet} ;-)

发表时间 Thu 17 Jan 19 @ 8:14 pm
blckjckPRO InfinityMember since 2008
But, if holding is false it continues on to load.
Changing the statement around helps me make a little more sense. With the following, the deck that is not automixing would load and unload.
And, when nothing was playing and automix was off why wouldn't it continue on to the holding statement?

var 'hwmixer' ? nothing : automix ? play ? automix_skip : holding ? unload : load


var 'hwmixer'
..? nothing
..: automix
....? play
......? automix_skip
......: holding
........? unload
........: load

发表时间 Thu 17 Jan 19 @ 9:05 pm
locodogPRO InfinityModeratorMember since 2013
There's always a chance of a bug/weirdness, but sticking to boolean/binary, it should be predictable. Every query has two replies, the two replies come before any two query-replies before it, but the false reply comes after any replies to queries contained in the previous queries true reply.

[Bold bit should be enough]

发表时间 Thu 17 Jan 19 @ 9:33 pm
blckjckPRO InfinityMember since 2008
Between the above and
locodog wrote :

Is it raining ? Yes it is but do i need to go outside? Yes i do get me a brolly : no i dont need to go outside, a brolly isn't needed : no it isn't raining no brolly for me thanks

Lets look at that as logic
All logic questions have only two possiblecanswers yes/no, 1/0, on/off and script queries need to know what to do in either case

Ask a 1st question get a yes answer as part of the yes answer ask 2nd question get a yes answer, get a brolly : get a no answer to the 2nd question, no brolly, get a no answer for the 1st, no brolly
.

from
https://www.virtualdj.com/forums/223743/General_Discussion/Script_School.html?page=1
I have sorted out my issue.

It was the order of operations. I couldn't get out of the left to right flow in my head.

Thank you both for your time.

发表时间 Thu 17 Jan 19 @ 11:49 pm