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?
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?
发表时间 Sat 02 May 20 @ 12:41 am
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?
button 2 is pressed before trying button 1 right?
发表时间 Sat 02 May 20 @ 1:04 am
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
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
发表时间 Sat 02 May 20 @ 2:17 am
How strange! I'm trying to add text to the search bar:
Button 1:
Button 2:
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.
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.
发表时间 Sat 02 May 20 @ 3:34 am
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
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
发表时间 Sat 02 May 20 @ 5:06 am
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 ?
You can check for this using down ?
发表时间 Sat 02 May 20 @ 5:29 am
@adion waow! what a strange way
but it works !!
var searchprogressive ? set searchprogressive 0 & down ? search progressive
but it works !!
var searchprogressive ? set searchprogressive 0 & down ? search progressive
发表时间 Sat 02 May 20 @ 9:24 am
Another way would be
var_equal "searchprogressive" 1 ? search_add "progressive " & up ? set 'searchprogressive' 0
var_equal "searchprogressive" 1 ? search_add "progressive " & up ? set 'searchprogressive' 0
发表时间 Sat 02 May 20 @ 9:33 am
any rule of thumb for what acts on release and what on press?
发表时间 Sat 02 May 20 @ 9:44 am
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
var_equal myvar 1 ? effect_select & up ? set myvar 0
发表时间 Sat 02 May 20 @ 9:53 am
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.
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.
发表时间 Sat 02 May 20 @ 10:48 am
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!
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!
发表时间 Sat 02 May 20 @ 12:04 pm
var_equal "searchprogressive" 1 ? search_add "progressive " & up ? set 'searchprogressive' 0
Works perfectly! Thanks everyone, particularly @Adion!
发表时间 Sat 02 May 20 @ 10:06 pm