Randomizer on 3 Grouped buttons, How?
-
@d-healey Haha, That Was A Real Challenge, And Yep This is it :)
Content.makeFrontInterface(600, 500); const var Btns = [Content.getComponent("Button3"), Content.getComponent("Button2"), Content.getComponent("Button1")]; inline function onRandITControl(component, value) { local randomValue = Math.randInt(0, 3); Console.print(randomValue); if (value == 1) { Btns[randomValue].setValue(1); } }; Content.getComponent("RandIT").setControlCallback(onRandITControl);
-
Yeah looks like you got it! Well done!
-
@d-healey :) Haha Yessir :)
Thanks You Dear David, True Legend :) -
@Natan You did it, not me. I just nudged you :p
-
@d-healey Thanks for the help, You're a great guy :)
-
@d-healey Just trying this out. What if I wanted only one of the buttons to be on at a time? Like a radio group. I can get them to go on and off randomly, but not like a radio group...
-
@DanH Check out my tabbed interfaces video.
-
@d-healey ah yes of course :) I'm already using it!
-
@d-healey Ok I am failing miserably at trying to combine these two scripts
-
@DanH Post a minimal snippet
-
HiseSnippet 1196.3ocuW8tahbCD2aR1SGaKU8j5CfU9vIPWJAR3tVI5oF96ITCDDPhZ0oSQlcMfU10FsqIMnnH0OUo9BzGo97z2f1wdWX2P1jlPSq+Bq8L+F+yyL1yPOegMMHP3iLxLbwLJx3yMGrfKmVeJgwQsafLdoY+pcabRGTsEyHAATGjgw1ePI0HyNH83O+9ZDWB2lFuDBclfYSOl4wjwq16nef451h3PGx7Rnc4iZaK30Eth4.S11rHZFw9BxDZWhRssLQFunoCSJ7GHIRZ.xXmZBmEClJ9Ydn9mwBXibopIkPC.CEtbKgqihwpUQ0mxbc5s7DGf.qzK97uc34+qL6vbXqVO1O7kZA3XDI8GFa8PzqTR5ULU5ULM5Yjfd6DRuWYNv1mMSFKQwsOyrMWR8GSfPPRZEpKZqe0zrt.zfKK3Qtf1xGlrBQt2Ur3d32VrX9JYsxZsOLvc9IbsSGN7jtCv43PLvA6S3NBO7XgOlKv9TRffmOqED1Bj3KI93QRd+PcdO9iK2sITYcg2LAGlja2vDoR6leurV3zGODvC1TfGto.Kua9OE6T5VcXUvgDJJx+nDx3tLNEOdN2VxDbrP6HZOTYYegaN6klcOvQ4Nml25ZKMabE1D2HO6YJIfqqCQNsfZIH9jChKGluhUDMCDtzBy7YffDXxWAjFZO1XbtKCsy6wkxqW65km6UwmOl.7mJDPk5uxUJZitIT8rIXHy4JfYqLPAF2gd0IiiOXpLGMJU5QNFnbwJXF96RfwkxmHmBq9l2jOT4qiCIwbikfQL0wPs2u90QNtns4lvertohk08D9zAfcyqLVTXnNw0cD7pRt0BOIx5GVsVslMvs6NrY+VUq2DOnd+18FpjGmm28zNmCJN.Njk0PW+LuTgkm0ny45mw0ok8TBeBcHYjhP2DxIXFdzboDRprizaUZ1cy6VYg6lwshE6u+GnRrN.hEiw1tL6Kfa2gaxlEyWkr.7ULYhKMxZAgq9+VJQjWCBHwWD6JjzS34T23xXciEdcQiGmprnXiK0OUwphW9ODvb74din9ItuqUDdE+1kILu+xDIqhYGlimPQAuMmIOYFkee01PQWLfxHlQrBTUpKh7EQEQpoiSHFTqHSTU9RHMkUEOPOAXGrB1VOEXGtY6V4mFLnCF8E9knh6QAcZ6FDIQUpMxcAtvYTeISEcLZPuD5gIrvaFyFzfKjhYZ+Yzc.36GgG8JPMieG1sEpONF9fxIPXV0OwwThOeYC.OEydvZl82ddL6gqY1+34wrkWyr6X7HL6K9minWsJZ9KsNZQbnsxQoZcVPGgGXah+Bcp5c6uB5xS3L2kHucqep9ciD.WzuUOVp9n3AL4hj8C+utevTuR+Ho6qL6wj1SSmuakBeg7++q4aT20YMaNdL0VFS1cLa8iOusRmJU5KlKY7IP2U9LUpX24dCf+rgMEXBmScUOFCIDJn54EUyUdlATtidxeAiHgkTyMhDVZoPjGw1Wbtc3CRp92eodEfSb8eiIiYG0b7p2XMMKVnHxCxQO21V4J9Zf6oi4fM.yga.lxa.l2tAXd2Ff4a1.Le6ChQ87P04RgW30DXgdM0EDLLZpe+PmQh9abY+UfD
:folded_hands_medium-light_skin_tone:
PS - Just looking back at the tabbed interface script and realising that I actually understand what is does, as opposed to not having a clue a few weeks back :face_with_tears_of_joy: Thanks for the help on that score....
-
@DanH said in Randomizer on 3 Grouped buttons, How?:
HiseSnippet 1196.3ocuW8tahbCD2aR1SGaKU8j5CfU9vIPWJAR3tVI5oF96ITCDDPhZ0oSQlcMfU10FsqIMnnH0OUo9BzGo97z2f1wdWX2P1jlPSq+Bq8L+F+yyL1yPOegMMHP3iLxLbwLJx3yMGrfKmVeJgwQsafLdoY+pcabRGTsEyHAATGjgw1ePI0HyNH83O+9ZDWB2lFuDBclfYSOl4wjwq16nef451h3PGx7Rnc4iZaK30Eth4.S11rHZFw9BxDZWhRssLQFunoCSJ7GHIRZ.xXmZBmEClJ9Ydn9mwBXibopIkPC.CEtbKgqihwpUQ0mxbc5s7DGf.qzK97uc34+qL6vbXqVO1O7kZA3XDI8GFa8PzqTR5ULU5ULM5Yjfd6DRuWYNv1mMSFKQwsOyrMWR8GSfPPRZEpKZqe0zrt.zfKK3Qtf1xGlrBQt2Ur3d32VrX9JYsxZsOLvc9IbsSGN7jtCv43PLvA6S3NBO7XgOlKv9TRffmOqED1Bj3KI93QRd+PcdO9iK2sITYcg2LAGlja2vDoR6leurV3zGODvC1TfGto.Kua9OE6T5VcXUvgDJJx+nDx3tLNEOdN2VxDbrP6HZOTYYegaN6klcOvQ4Nml25ZKMabE1D2HO6YJIfqqCQNsfZIH9jChKGluhUDMCDtzBy7YffDXxWAjFZO1XbtKCsy6wkxqW65km6UwmOl.7mJDPk5uxUJZitIT8rIXHy4JfYqLPAF2gd0IiiOXpLGMJU5QNFnbwJXF96RfwkxmHmBq9l2jOT4qiCIwbikfQL0wPs2u90QNtns4lvertohk08D9zAfcyqLVTXnNw0cD7pRt0BOIx5GVsVslMvs6NrY+VUq2DOnd+18FpjGmm28zNmCJN.Njk0PW+LuTgkm0ny45mw0ok8TBeBcHYjhP2DxIXFdzboDRprizaUZ1cy6VYg6lwshE6u+GnRrN.hEiw1tL6Kfa2gaxlEyWkr.7ULYhKMxZAgq9+VJQjWCBH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rP9BnoPM5ENNpPwOBbe0XNbCvbzFfozFf4Ma.l2tAX9oM.yO+nXTWOTYtTLM7XBHnaCcCCCiF56OzUjn+yfTygo
-
plus this small change to your random number generator
local randomValue = Math.randInt(0, 4);
-
@Lindon YES! :clapping_hands_medium-light_skin_tone:
Thanks, and yes just noticed that 3-4 change :)
Thanks mate
-
@DanH Sooooo.... As ever when trying to implement it in my existing project it tends to go out the window! :grinning_squinting_face:
I'm trying to add in a line to switch filter modes by storing the filter mode values in an array and referring to it in the callback. HISE hangs when I try to do this... I've commented in the script where this happens. Would be super appreciative for any help :)
HiseSnippet 1433.3oc0X8taSbDD+tjbHraCpTUUoJ0OrJe.NKLN1IFnRAD9OwlZUriI1PaEJBs9t01qx4cM2sFvJJR8QnOR7HwaP6r6smuKINNFCTUtHExty7a1e6LyMybz1m6PBB39Flo5NcLwv7as5LkIFVcHlxLZrug40sNrbq8OnoQkoiwAADWCSy0ehTpYpMLTOe3wUvdXlCIdKCiWvoNjmRGQEw61tzuQ87picIcoiRncwRMb3rpbO9DfIqak2XL14X7.RKrTs0rLLuVMWpf62QfEj.CyMpvcm1YH+srP8eAMf1yiHWTvnCXnvsqy8bkLVtqQ0gTO21Q23.CvJsiu+qGd++AqlTW5r8i8CemR.JFQR+g4ZKhdERRu7KO8LSPuMBo2Ms533SGKhkH412X0fIH98wPHHIsB00Xs+9ZVU4fFLQtQ3iI08gEyPXe+74yhtW97Y1ayzPXHPfdC1GUm5AJT.8HjJgH2.hnV+9DGg8VZQaIArM7fZ9mnJOua2CZ0AYyfPlKxGyb4iP849HFG4SvAbVljlumfcXnNOB8xHxAmQU9nwbFrvdqv7N3XxtYZz7eVDvcVUf6tp.KtUlitfOrI2kDHuj2OK5AYQE1IKp3QQNtVk6VFbZgv09vMSuYZJyixHn9SXNBJmg3JmUitxS2m6Y6DczYgywaBIS5SRqXrG2A6o89uPJAN4lXH7I2BB41PntXl8RquJAbORtw9TPPBLY1CjFZOZej8aBsyiPExn16jHeyrX3KS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7FifNMuxwQVP6t.2mOlcVAL6tBXJtBXt2Jf49q.lGrBX9kEhQ1ju7DAeTXtIrQ6Zpw9LMqolBPklZ7uXoUlsA
-
These two lines do exactly the same thing
local idx = btnRandom.indexOf(component); local idf = btnRandom.indexOf(component);
Why are you doing this twice?
-
@d-healey I'm not... HISE hangs when I change it to idf = FiltModes and click on the Main Workspace button... I think it should be:
local idx = btnRandom.indexOf(component); local idf = FiltModes.indexOf(component);
-
FiltModes contains numbers
[6, 7, 12, 4]
why would you try to get the index of a component from there? -
@d-healey Ah I see, so it needs to be .indexOf(whatIneedittobe...)?!
-
@DanH I don't know what you're trying to do so I don't know :P