快速登录:  

Forum: General Discussion

话题: while_pressed doesn't work as expected in if query
My goal: As long as the button remains pressed, the filter should be set to 0% if it was previously 50%, otherwise it should be set to 50%. When you release the button, the original value should be assumed again.

filter 50% while_pressed
sets filter to 50% but the old value will not be assumed again.

I tried
param_equal filter 50% ? filter 0% while_pressed : filter 50% while_pressed

and
(param_equal filter 50% ? filter 0% : filter 50% ) while_pressed

and with var
set '$fil' filter & var_equal "$fil" 50% ? filter 0% while_pressed : filter 50% while_pressed

Nothing works. Can you help me?
 

发表时间 Fri 19 Apr 24 @ 5:21 pm
volume 100% while_pressed
is described as example in vdj-script-wiki and it does'nt work for me.
The old value will not be assumed anymore. Is this a bug? (My version: v2023 b7607)

I tried an old version of vdj and it works well.
 

发表时间 Fri 19 Apr 24 @ 8:21 pm
Now I installed the newest Version (v2024 b8095), but there is the same Problem.
 

发表时间 Fri 19 Apr 24 @ 10:13 pm
AdionPRO InfinityCTOMember since 2006
Both volume 100% while_pressed and filter 50% while_pressed work fine here.
Where are you applying these scripts exactly? Controller, custom button, pads, skin, ...?
 

发表时间 Sat 20 Apr 24 @ 5:48 am
Thank you Adion, yes you are right. I found in the file KEYBOARD_user_mapping.xml that for any dubious reason ( maybe my Hot-Keybord-Program) generates 2 empty lines at the end of the command and before /> . When I deletet the 2 empty lines it works well.
I deaktivated Hot-Keybord and now the vdj-Editor works correct too.
Therefore
filter 50% while_keypressed
works correct!!!!

but

filter 50% ? filter 0% while key_pressed : filter 50% while key_pressed

does not work like I wish.
 

发表时间 Sat 20 Apr 24 @ 12:16 pm
sorry: while_pressed !
 

发表时间 Sat 20 Apr 24 @ 2:37 pm
locoDogPRO InfinityModeratorMember since 2013
it doesn't work that way
 

发表时间 Sat 20 Apr 24 @ 2:50 pm
My goal: As long as the button remains pressed, the filter should be set to 0% if it was previously 50%, otherwise it should be set to 50%. When you release the button, the original value should be assumed again.

I tried a solution with variables, the setting to 50% works but the setting to 0% doesnt work. If filter=50% it stays 50% while_pressed. Maybe var_equal does not work.

set '$old' 'filter' & var_equal "$old" 50% ? set '$new' 0% : set '$new' 50% & get_var '$new' & param_cast percent & filter while_pressed

Can you help me?
 

发表时间 Tue 23 Apr 24 @ 12:53 am
locoDogPRO InfinityModeratorMember since 2013
set oldfilter `filter` & param_equal 0.5 filter ? down ? filter 0.0 : get_var oldfilter & param_cast & filter : down ? filter 0.5 : get_var oldfilter & param_cast & filter
 

发表时间 Tue 23 Apr 24 @ 6:44 am
@LOCODOC: Thank you a lot for your great help. Yor script works well for short presstimes. I think autorepeat is the reasen for jumping between 0% and 50% when pressed for a long time.
But with your help I updatet my try. The brackets are necessary.

Solution:
(param_equal 0.5 filter ? set '$new' 0% : set '$new' 50%) & get_var '$new' & param_cast percent & filter while_pressed
 

发表时间 Tue 23 Apr 24 @ 2:00 pm