Quick Sign In:  

Forum: VirtualDJ Skins

Topic: Multiple IF/tests

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

ProgDHome userMember since 2017
Hey,

Just registered on the forum after lurking from my bedroom DJing, trying to make my own skin but can't work out the VDJscript to go with it.
What I have is an effect bank with a Left and Right selection button (Apply effects to left/right deck).
So there are 4 options:
Left & right active
Left active but right not
Left not active but right is active
Both not active (for whatever reason, not really required)

But I can't figure out how to code it, I can nest the var checks but they don't cover all options.
I got to this:
var '$Left' 1 ? deck 1 effect_activate 1 'flanger' & var '$Right' 1 ? deck 2 effect_activate 1 'flanger'
Obviously this only activates the right deck effect when the left deck is active too...
Usually I'd solve this by just doing it twice, something like:
var '$Left' 1 ? deck 1 effect_activate 1 'flanger' & var '$Right' 1 ? deck 2 effect_activate 1 'flanger' : var '$Right' 1 ? deck 2 effect_activate 1 'flanger'
Which I hoped would check if $Left is 1 and if it is then check if Right is 1 or if Left is not 1 go to the : part but that links to the Right check.
Gets quite confusing anyway.

Any way to do a var check, end that check and run another separate check after it regardless of the result of the first var check?
 

Posted Sat 09 Sep 17 @ 3:00 pm
locoDogPRO InfinityModeratorMember since 2013
I made a wish of this earlier, something like a end script char or a new script verb, not possible yet
Try like this
var '$Left' 1 ? var '$Right' 1 ? deck 1 effect_activate 1 'flanger' & deck 2 effect_activate 1 'flanger' : deck 1 effect_activate 1 'flanger' : var '$Right' 1 ? deck 2 effect_activate 1 'flanger' : nothing

var '$Left' 1 ?
-->var '$Right' 1 ?
-->-->deck 1 effect_activate 1 'flanger' & deck 2 effect_activate 1 'flanger' :
-->-->deck 1 effect_activate 1 'flanger' :
-->var '$Right' 1 ?
-->-->deck 2 effect_activate 1 'flanger' :
-->-->nothing

the problem is doing it this way every extra query double the text size of the script, not a problem here but I've had scripts running to 70K chars
you can do this [this is about the same size for your simple script but will save typing for 3+ query scripts]
repeat_start_instant 'rsiCheckInSteps' 33ms 2 & cycle 'StepVar' 2 & var 'StepVar' 1 ? var '$Left' 1 ? deck 1 effect_activate 1 'flanger' : nothing : var '$Right' 1 ? deck 2 effect_activate 1 'flanger' : nothing

repeat_start_instant 'rsiCheckInSteps' 33ms 2 & cycle 'StepVar' 2 & var 'StepVar' 1 ?
-->var '$Left' 1 ?
-->-->deck 1 effect_activate 1 'flanger' :
-->-->nothing :
-->var '$Right' 1 ?
-->-->deck 2 effect_activate 1 'flanger' :
-->-->nothing
 

Posted Sat 09 Sep 17 @ 3:12 pm
locoDogPRO InfinityModeratorMember since 2013
ProgD wrote :

Usually I'd solve this by just doing it twice, something like:
var '$Left' 1 ? deck 1 effect_activate 1 'flanger' & var '$Right' 1 ? deck 2 effect_activate 1 'flanger' : var '$Right' 1 ? deck 2 effect_activate 1 'flanger'


You missed the " : nothing" for left true right false
This is what you asked

var '$Left' 1 ?
-->deck 1 effect_activate 1 'flanger' & var '$Right' 1 ?
-->-->deck 2 effect_activate 1 'flanger' :
-->-->var '$Right' 1 ?
-->-->-->deck 2 effect_activate 1 'flanger'

This is what you should have asked

var '$Left' 1 ?
-->deck 1 effect_activate 1 'flanger' & var '$Right' 1 ?
-->-->deck 2 effect_activate 1 'flanger' :
-->-->nothing :
-->var '$Right' 1 ?
-->-->deck 2 effect_activate 1 'flanger'
 

Posted Sat 09 Sep 17 @ 4:12 pm
ProgDHome userMember since 2017
You sir are a genius! (And I need to research better...)
That works, thanks so much this was driving me crazy.

Also, that fast response, awesome!
 

Posted Sat 09 Sep 17 @ 7:18 pm
locoDogPRO InfinityModeratorMember since 2013
No worries, it was skinning and asking questions (and trial & error, erro,r error) that developed my script knowledge.
Keep at it and when you get stuck ask a question.
 

Posted Sat 09 Sep 17 @ 11:50 pm


(Old topics and forums are automatically closed)