Toggle thru Array help



  • Hello all,
    I'm trying to create 2 buttons that will toggle back and forth between an array index. I've gotten pretty close.... My Increment button works as it should, but the Decrement button will go into
    negative numbers.
    Here's what I got so far. Maybe you can spot something I'm missing.

    HiseSnippet 1109.3ocsW0maZbDEeVLaa.WhRh5AXDRQZQ9irPrapjqUwfwUnXiQFaqJYEEMrL.i7tyf1cvInHeW5goGgdP5Mn8M6rvtfWv1T08u3807627l27lGs8ENzf.gOxH2kSFQQF+fYmIb4v5CILNp4wHiWZdFIPR8wZU0lLhDDP6gLL132TJLxkEE982+ZMhKg6PiUgPWKXNzSYdLYr11U+Hy08DRO5kLuDduW0lNBdcgqXLvmMLsQiHN2RFPaQTtkwDY7cM5wjB+NRhjF.9TSzaRmghuv09eMKf00kpDJi5.KjVMp9Plau1S2qAHjQ11w67Mz67ez7LVO1L8wYfWEZ.GGQxbfQl4oT14nT4kQoSDt8TKvRnmQB5kUSuWa1wwmMRFaQwsMMaxgCm9DHsmjVZeQY9yrl0EfGb4tdjaom3CByhvZea6sw6YaW5fB4KjGR9AR7cDebswRofWFeHdZvCnx5BuQBNHXULxdQUbKFUkGIpJEe.ZD9sZaG46Sl.weyi.61ExiW02if+mVf.mR5RcW9tUaNh1KR7.HL82MKmT1qfvkWgsJqv16Wgs8Vgs8WtIcd4cuCW6nVeD2owoMpe44Wnzw3tLNE2eL2QxDbryXeeH2nR.cntTG3BfkyzL11PxwcLsTg7eSiEqO1J5rSkZuVY0pD9vCwkKo83awjJwRCoVqjh6.9ieqNsuqKkOPN7fv3tWG9hnU4+DZakBZEx+P7zkG6FPgREI8qxhaiKV+pKtnQqK0IxCwEgEKwRqpjtOLW2W3isXfG1GfY3eYwqBSgEy1ZqRproFwE75F1mTnqJd8Et0Ittcg9lVobFU5f72qVDUw676bafNyNcE7VBI8btEfY9b4uOOdQS86mpsHJ3R8S0rpcu+pBzhO1qK0eZAzTGgdfy2jcymVSVG804DNJ3M4L44inQxwsgU1z65oVsQy1rIUEuGSpMbqkhawpdXWdTT6FneelH2AWkgc6eYT2d8wLhAbLmYzcHTX1I4qrnmQ3URI7qZdLQRTu6DQIflin9RlJYabL8N3Qb8qP4LOlFbqTLBfZVKRjw2+DX8WmAI1o5DjgoweA+lEblvCVChOnxHi5BjJesC5KrdxgwrrUUzyBuJIw6tGEusdR3UHBuvq7gv8BS80+Dn8GcUnMcctpZzBaZroABMjxFLTpjdKXTi9aLWncATr7v2+goPD8F6RjyOZhZFrHCvUo4lAP8NOOfImjbFsmw7J1oNuR4zpjehz80lsYRmgoy2LovW0Ui+m4azzeELazuOzjLlrYMO42W2Q8dFT4BwXIiO3LhzmAEQlsF60AF.1gBLgyotAphkLp63ZYakrJyzgx6EJ7OvWjwxJYiHikmZD4Qb7Ee1Q2jPMe4KB0.bhGNZcNXFePFOq0hoo8t1HOXr2O63nRE6.bO8XprFw790Hl8ViX1eMh4mViX9vZDyOuxXT+iiiFKEd5qIfh1MB6QaXzfSfprvJRz+BDYsV5.


  • Here's the quick and dirty solution

        if (Button1.getValue() == 1)
        {
            currentBank = (currentBank - 1) % Banks.length;
            if (currentBank < 0) currentBank = 5;
        }
    


  • @d-healey Brilliant!


Log in to reply
 

4
Online

491
Users

1.7k
Topics

13.0k
Posts