Help Me Get SliderPack Values please! Thank You!
-
Im working on an Arp preset menu. I've got all of the values properly reading in and out for the sliders, knobs and comboboxes. The only thing I cant seem to get is all the values of the slider packs. I can think of the long way to do it but I want to do it in a loop. Can somebody give me some advice on what im doing wrong here please.
reg sp2Values = []; local NumSliders = knbNumSliders.getValue(); for (i = 0; i < NumSliders.length; i++) { sp2Values.push(SliderPack2.getSliderValueAt(i)); } Console.print("SliderPack2 values: " + sp2Values);
this is what I get with this....
this isnt one instance, this is me mashing the save button lol. -
C Chazrox marked this topic as a question
-
@Chazrox sp2values is an array so it's working correctly
-
@d-healey How do I print out all the individual values?
-
@Chazrox said in Help Me Get SliderPack Values please! Thank You!:
SliderPack2.getSliderValueAt(i)
-
@d-healey How come its not working for me? It just says "Array" .
-
-
@Chazrox because your trying to print the array, Console.print only prints strings, so you need to either print the value in the loop where you're getting it or convert the array to a string
-
@d-healey help please.
Im trying to push these numbers to a globally declared array so I can save it to my preset menu. I found a thread where you talked about having to deal with .getSliderValueAt(); within the onControl callback so Im trying this now.
Does this still work? I know that was an old thread.
function onControl(number, value) { local numSliders = SliderPack2.getNumSliders(); for (i = 0; i <numSliders.length; i++) { sp2Values.push(SliderPack2.getSliderValueAt(i)); //Value gives you the index of the slider } Console.print("Index: " + value + " Slider Value: " + sp2Values); }
-
@Chazrox Console.print(trace(yourArray)) ;
-
Maybe this helps explain it better
const n = 10; Console.print(n); // 10 const s = "Hello"; Console.print(s); // Hello const a = [1, 2, 3] Console.print(a); // [array] Console.print(a[0]); // 1 Console.print(trace(a)); // [1, 2, 3]
Trace converts an array or object to a string.
-
@d-healey I Love a good cheat sheet! Thank You!