Quick Sign In:  

Forum: General Discussion

Topic: Help with scriptiing a Custom Slider Button - Page: 2

Dieses Thema ist veraltet und kann veraltete oder falsche Informationen enthalten.

When do I do I need the back ticks on parameter? in this case level is defined by VDJ as value of a volume fader.

Is it advised to use `level` in

param_greater 50% `level` 


since the code below also works without the back ticks
param_greater 50% level 


 

geposted Sat 26 Dec 20 @ 9:14 am
NicotuxHome userMember since 2014
Important note: this is only right in a script and real sliders, this won't work correctly in a custom slider
specially using encoders (controller) or scroll(touch screen) or mouse roll(mouse)

In a custom slider relative values are passed and parameters are two different things and a modification to parameter make slider position wrong
customslider value have to be kept in a SLIDER SPECIFIC variable to be the right one
(in one word, custom slider are not really sliders anymore)

set v & param_cast absolute & set v `get_var v & param_bigger 0.0 ? param_bigger 1.0 ? constant 1.0 : get_var v : constant 0.0` & param_add 0 `get_var v` & ...



"set v" sets the absolute value of the slider (apply relative ones not taking care of slider bounds) (can be <0.0 and > 1.0, most of the case +/-0.6250 +/-0.03125 depending on speed)
"param_absolute" convert relative value to absolute giving the ability to set the correct position to slider but is currently is totally inaccurate (i.e.: +/-0.03125)
"set v `...`" sets the value in real range a slider can display (0.0 .. 1.0)
"param_add 0 `get_var v`" is a hack to overwrite the bad value converted from relative with the correct absolute value to display
&... from there the action can be done using parameter which is now right absolute value, in correct range

in example, the value 1 between 50%..75% and 0 otherwhise (using cast rounding)
set myvar `level & param_bigger 0.75 ? constant 0 : param_cast int`

the backquote are not needed with "param_*" verbs when actions are one word only
in most of other verbs they are needed or not allowed, only trial and error can help
 

geposted Sat 26 Dec 20 @ 9:25 am
locoDogPRO InfinityModeratorMember since 2013
param_greater is expecting 2 things, that could be an actions or values, or a mix
since it is expecting an action it can work with no spaced actions without ` ` so, level, get_level etc will be fine.
however, if there's a space in the action, lets say
effect_slider 'echo' 1
the space will mess things up so you would need to encapsulate ` ` , I believe encapsulate works with " " & ' ' too

param_equal, is slightly different, it is expecting either action, value or a string so, wrapping with " " or ' ' is reserved for strings.
Most of the time if doing a comparison on an action, wrapping the action in ` ` can't hurt there is one exception I'll try remember what it was.
*edit, I was remembering the wrong thing
 

geposted Sat 26 Dec 20 @ 9:40 am
NicotuxHome userMember since 2014
i try again as post does not appear

`level & param_bigger 0.75 ? get_constant 0 : param_cast int`

backquote only not needed with "param_*' when action is one word only
most other verbs are needing backquotes or ignore them
as locodog said there are "exception" . trial & error only can help


All the above tests and comparisons are only working with scripts and physical sliders but not with custom_sliders
(custom sliders are not real sliders anymore for a while)

so that user slider have to be scripted in a way to make it work correctly
they need a specific variable (each) to handle value, specially using relative scroll, slide & move
(encoders, touchscreen, mouse roll)

set v[INDEX] & param_cast absolute & set v[INDEX] `get_var v[INDEX] & param_bigger 0.0 ? param_bigger 1.0 ? constant 1.0 : get_var v[INDEX] : constant 0.0` & param_add 0 `get_var v[INDEX]` & ...

set v : save the wrong absolute value (not in slider range)
param_cast absolute : convert param for future use
set v `..` : fix correct value for the slider
param_add 0.0 ... : hack to be able to overwrite parameter with correct absolute value and update slider display accordingly
& ... : now parameter is in range [0.0..1.0] and correct absolute value is passed to the script
 

geposted Sat 26 Dec 20 @ 9:49 am


(Alte Themen und Foren werden automatisch geschlossen)