Automatic sliders script modification

I have found this little C# script on the forum. It generates automatically a number of sliders for a referenced component. I want to modify it so I can input min and max values for the sliders and also a starting value. I can do it if I use integers, but I fail to do it for floating points. I don’t know in which part of the script the conversion to decimal should happen. Also now it only connects the sliders to the second input. Could this also be manipulated? Thanks for any help in advance.

Sliders.gh (10.7 KB)

1 Like

Yeah but I want to do it in C#, plus in this you can’t create a set number of sliders, only manipulate existing ones.

The only problem was that you ignored some rules for naming variables. First of all, don’t name them like types. For example you had “Decimal” as an input name for the component and additionally you had an input called “Starting Value”. First of all these are two words and second again a type as a name.

Sliders_fixed.gh (7.7 KB)

I get it but this does not set min and max or the starting value for the generated sliders.

You haven’t implemented it. That’s why. Why you want to do it in c#?

Sliders_fixed.gh (13.5 KB)

3 Likes

_min = Convert.ToDecimal(Min);
This Convert line is what I was missing! Thank you! Epic!
I wanted it in C# because the original is in C# and it seemed simple enough.

I remember a thread where Mr.A create the same idea and David Rutten create another one; than i tried to create new from both of their scripts.
There is also GenePool controller from Heteroptera addon

Slider Instantiate new.gh (14.5 KB)

1 Like