Old 12-20-2018, 08:14 PM   #1
groove
Human being with feelings
 
Join Date: Apr 2014
Posts: 26
Default Custom non-equal increments in slider possible ?

Is is possible to have values in the slider parameter range be non-equal intervals ?
Would like to specify a series where slider1 values could be 1,2,3,5,10,20,45,79,100 ... not 1,2,3,4 ... 100

Groove
groove is offline   Reply With Quote
Old 12-21-2018, 12:54 PM   #2
IXix
Human being with feelings
 
Join Date: Jan 2007
Location: mcr:uk
Posts: 3,889
Default

No. Assuming your desired values can't be derived from some maths formula, the way to do it would be to map the slider value to a memory array containing the actual values, something like this...
Code:
slider1:0<0,9,1>Value

@init
vals = 0; // set the address of the array
vals[0] = 1;
vals[1] = 2;
vals[3] = 3;
vals[4] = 5;
vals[5] = 10;
vals[6] = 20;
vals[7] = 45;
vals[8] = 79;
vals[9] = 100;


@slider
slider1 = floor(min(max(slider1, 0), 9)); // clamp to prevent bad index

value = vals[slider1];
...but of course the slider will still read 0-9. If that's not acceptable then you'd have to make a custom GUI.

edit: doh! forgot that you can make sliders into dropdowns so you can do
Code:
slider1:0<0,9{1,2,3,5,10,20,45,79,100}>Value

Last edited by IXix; 12-21-2018 at 01:38 PM.
IXix is offline   Reply With Quote
Old 12-22-2018, 06:13 AM   #3
groove
Human being with feelings
 
Join Date: Apr 2014
Posts: 26
Default

IXix thanks for outlining some coding options.

Groove
groove is offline   Reply With Quote
Old 12-25-2018, 11:12 AM   #4
ashcat_lt
Human being with feelings
 
Join Date: Dec 2012
Posts: 7,271
Default

Quote:
Originally Posted by IXix View Post
N...but of course the slider will still read 0-9
One could have a second "read only" slider that shows the actual value.

Code:
@slider
slider1 = floor(min(max(slider1, 0), 9)); // clamp to prevent bad index

slider2 = value = vals[slider1];
ashcat_lt is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 02:36 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.