Quick Sign In:  

Forum: VirtualDJ Technical Support

Topic: VDJ Script processing order: variables and actions

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

K0mixPRO InfinityMember since 2012
I want to make a button that only performs an action once, then won't perform the action again until a second button is pressed, regardless of how many times the first button is pressed.

I've tried doing this by using a boolean variable that is turned off once the first button is pressed, and is turned on again when the second button is pressed:
- Button 1: var_equal "my var" 1 ? action1 & set "my var" 0 : nothing
- Button 2: set "my var" 1

However, all that happens when I press Button 1 is the variable "my var" is set to 0 (checked using var_list), and the action doesn't occur.
I presume changes to variables are prioritised before actions. Is there any way to force VDJ to perform the action first?
 

Posted Sat 02 May 20 @ 12:41 am
locoDogPRO InfinityModeratorMember since 2013
no it's pretty much read [and acted on] left to right, maybe something wrong with action1
button 2 is pressed before trying button 1 right?
 

Posted Sat 02 May 20 @ 1:04 am
NicotuxHome userMember since 2014
tested in boolean
button1 : toggle myvar
button2 : var myvar ? play_button & toggle myvar : nothing
everything working fine

maybe something wrong with action1 ... unless action1 use an inherent parameter or are buggy
i.e.:
var myvar ? nothing & effect_select & toggle myvar : nothing
will never work for some reason
 

Posted Sat 02 May 20 @ 2:17 am
K0mixPRO InfinityMember since 2012
How strange! I'm trying to add text to the search bar:
Button 1:
var_equal "searchprogressive" 1 ? search_add "progressive " & set 'searchprogressive' 0 : nothing

Button 2:
clear_search & set "searchprogressive" 1


The only thing that happens with Button 1 is "searchprogressive" changes to 0. Button 2 performs as expected.

I know that search_add "progressive" works every time, it just fails when I put it in this logic script.
 

Posted Sat 02 May 20 @ 3:34 am
NicotuxHome userMember since 2014
yes another issue
it seems VDJ does not want "search" or "search_add" to work correctly in many scipt
no way to set a var and set a search at the same time
 

Posted Sat 02 May 20 @ 5:06 am
AdionPRO InfinityCTOMember since 2006
Note that some actions execute on release instead of press. In that case your variable would be set on press and the release part never executed.
You can check for this using down ?
 

Posted Sat 02 May 20 @ 5:29 am
NicotuxHome userMember since 2014
@adion waow! what a strange way
but it works !!

var searchprogressive ? set searchprogressive 0 & down ? search progressive
 

Posted Sat 02 May 20 @ 9:24 am
AdionPRO InfinityCTOMember since 2006
Another way would be
var_equal "searchprogressive" 1 ? search_add "progressive " & up ? set 'searchprogressive' 0
 

Posted Sat 02 May 20 @ 9:33 am
locoDogPRO InfinityModeratorMember since 2013
any rule of thumb for what acts on release and what on press?
 

Posted Sat 02 May 20 @ 9:44 am
NicotuxHome userMember since 2014
and in which case, because annoying things for a long time just found a solution

var_equal myvar 1 ? effect_select & up ? set myvar 0
 

Posted Sat 02 May 20 @ 9:53 am
AdionPRO InfinityCTOMember since 2006
Execute on release is mostly used for actions involving user interface actions (opening/closing windows or dialogs etc...)
In the case of search it also changes the keyboard focus, so it's better to do on release so that focus doesn't change halfway through.
 

Posted Sat 02 May 20 @ 10:48 am
K0mixPRO InfinityMember since 2012
Brilliant! It didn't occur to me to think about the two stages of a button press!

I am about to go to bed here in NZ, but will give it a bash in the morning. Thank you everyone for your wisdom, I will report back with the results!
 

Posted Sat 02 May 20 @ 12:04 pm
K0mixPRO InfinityMember since 2012
var_equal "searchprogressive" 1 ? search_add "progressive " & up ? set 'searchprogressive' 0

Works perfectly! Thanks everyone, particularly @Adion!
 

Posted Sat 02 May 20 @ 10:06 pm


(Old topics and forums are automatically closed)