Hi there,
im trying to build a censor button - for video only. When a track will be loaded, a variable "xxx" is going to 1.
Now, i have a custom button below each deck. This custom button should blink, if the variable is 1. This custom button should not blink if the variable is 0. If the button will be pressed it should toggle the variable.
works so far.
But, if i add a command to switch on or off the shader to censor the video content, it doesnt work anymore:
How can i solve this?
im trying to build a censor button - for video only. When a track will be loaded, a variable "xxx" is going to 1.
Now, i have a custom button below each deck. This custom button should blink, if the variable is 1. This custom button should not blink if the variable is 0. If the button will be pressed it should toggle the variable.
var 'xxx' 1 ?
blink & down? set 'xxx' 0 : nothing
:
off & down ? set 'xxx' 1 : nothing
works so far.
But, if i add a command to switch on or off the shader to censor the video content, it doesnt work anymore:
var 'xxx' 1 ?
blink & video_fx "Shader" on & down? set 'xxx' 0 : nothing
:
off & video_fx "Shader" off & down ? set 'xxx' 1 : nothing
How can i solve this?
Posted Sat 26 Sep 20 @ 5:19 pm
That's the crux with VDJScript: Ternaries don't terminate. This means that if you have
This is what me and probably tons of other fiddlers have tried to deal with over the years, but i strongly believe (or rather hope) that this limitation has a good reason, probably to prevent people from coming up with scripts that will seem to work okay at first but possibly crash VDJ under specific circumstances.
Not having proper control structures probably makes the entire language design more deterministic.
If you wanna go further, you can always make a plugin.
conditionA ? actionB : actionC & conditionD ? actionE : actionFthen everything that's on the right side of the first colon will only run if conditionA is false. You cannot close ternaries. If you have multiple branches that need the same action somewhere inside, you need to copy and paste your code to those branches.
This is what me and probably tons of other fiddlers have tried to deal with over the years, but i strongly believe (or rather hope) that this limitation has a good reason, probably to prevent people from coming up with scripts that will seem to work okay at first but possibly crash VDJ under specific circumstances.
Not having proper control structures probably makes the entire language design more deterministic.
If you wanna go further, you can always make a plugin.
Posted Sat 26 Sep 20 @ 7:45 pm
Based on your synthax the shader must go on, if variable is 1. Why does it not?
(variable is 1)
(variable is 1)
var 'xxx' 1 ?(so, answer is yes)
blink & video_fx "Shader" onIts blinking so far, but the the part behind "&" will not activated.
Posted Sat 26 Sep 20 @ 8:20 pm
VDJ Monty wrote :
Hi there,
im trying to build a censor button - for video only. When a track will be loaded, a variable "xxx" is going to 1.
Now, i have a custom button below each deck. This custom button should blink, if the variable is 1. This custom button should not blink if the variable is 0. If the button will be pressed it should toggle the variable.
works so far.
But, if i add a command to switch on or off the shader to censor the video content, it doesnt work anymore:
How can i solve this?
im trying to build a censor button - for video only. When a track will be loaded, a variable "xxx" is going to 1.
Now, i have a custom button below each deck. This custom button should blink, if the variable is 1. This custom button should not blink if the variable is 0. If the button will be pressed it should toggle the variable.
var 'xxx' 1 ?
blink & down? set 'xxx' 0 : nothing
:
off & down ? set 'xxx' 1 : nothing
works so far.
But, if i add a command to switch on or off the shader to censor the video content, it doesnt work anymore:
var 'xxx' 1 ?
blink & video_fx "Shader" on & down? set 'xxx' 0 : nothing
:
off & video_fx "Shader" off & down ? set 'xxx' 1 : nothing
How can i solve this?
First:
Why do you need to query the down state of the button if the up does nothing ? Actions are always executed on "down"
Now:
Start simple:
var 'xxx' 1 ? set 'xxx' 0 : set 'xxx' 1
Then add more stuff:
var 'xxx' 1 ? set 'xxx' 0 & video_fx "Shader" on : set 'xxx' 1 & video_fx "Shader" off
Finally add query control:
var 'xxx' 1 ? blink & set 'xxx' 0 & video_fx "Shader" on : off & set 'xxx' 1 & video_fx "Shader" off
Unless I didn't properly understand what the button should do, the above code should work and perform what you want.
Posted Mon 28 Sep 20 @ 2:04 pm
1) maybe because there is a syntax error
var 'xxx' 1 ? blink & video_fx "Shader" on :
2) the button can't be down twice that's wrong:
var 'xxx' 1
? blink & video_fx "Shader" on & down
? set 'xxx' 0
: nothing
: off & video_fx "Shader" off & down
? set 'xxx' 1 : nothing
3) more working cases : (blink the same way PhantomDeejay's scripts )
down ? toggle xxx : var 'xxx' 1 ? blink & video_fx "Shader" on : off & video_fx "Shader" off
var xxx 1 ? blink & video_fx "Shader" on & toggle xxx : toggle xxx & video_fx "Shader" off
var 'xxx' 1 ? blink & video_fx "Shader" on :
2) the button can't be down twice that's wrong:
var 'xxx' 1
? blink & video_fx "Shader" on & down
? set 'xxx' 0
: nothing
: off & video_fx "Shader" off & down
? set 'xxx' 1 : nothing
3) more working cases : (blink the same way PhantomDeejay's scripts )
down ? toggle xxx : var 'xxx' 1 ? blink & video_fx "Shader" on : off & video_fx "Shader" off
var xxx 1 ? blink & video_fx "Shader" on & toggle xxx : toggle xxx & video_fx "Shader" off
Posted Mon 28 Sep 20 @ 5:14 pm