HISE Logo Forum
    • Categories
    • Register
    • Login

    Need Help with a Button that looks at other set of buttons!

    Scheduled Pinned Locked Moved Scripting
    5 Posts 3 Posters 263 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • NatanN
      Natan
      last edited by

      Hey folks

      I need a little help here:

      I Have 3 BTNs in a script node module.
      and I want to Set the third button to on if any of the buttons 1 or 2 are switched off

      Screenshot 2024-09-08 082901.png

      Here is the Snippet:

      HiseSnippet 1215.3ocyWE0aaaCDlx1Lc1qqXAX+.HxdwAHK0Joaq.ECMwNwaFawwnxyn6o.ZI5HBKQJHQ2Dug89941+AaGIkhjS7RcMvJVxK93cG4GO9cejZTpzmkkISQNMGuLggbdJ1aoPE1KjxEnAmgbdF9BZlhkRrC0cYBMKiEfbbp+i5AbZ1.Y968utKMhJ7YkCgPSjbe1uvi4pxQGcxOyih5SCXi4wUh9EmLvWJ5IijK.7TG2AkP8mSulMjpCqFF4ry4AbkL0SQUrLjSitxfkdgxaD13mvy3SiXZCWjGLQ1g6KiBzHV+aTuPdTvnh8cFBlkQkUg51pvWgufGvua7xpwWZbPJynZ8vo1pvq9JvysJ75TAdqARNUfTCKj1E64mxSTkdz34ywCDvgyLJT1qBEarnZecMbOIDgPcXLcNqeJXbWFsOpSmCHtc5r+qZ0pET6yTj2QSI1j6+VWxOPLrgCuloNe1Llup8dVmDv6dPZ1jltPofe.gWrXPBmFE0SFmHEfcV685ZhQmSqYxTR6aIbQQh62p4sGlwT5rSkQ8nQQSgi91RgMq7wgba1hKh3BFY1BguhKEj6ESa+h07.XuDsfseq+nUym+bx.xPFKfnjD+Pp3ZFQExrQPjyHcGO7XsOWBeFLklwzATryf8SFL1LyTQEA5vlJUg4NDG7v4eLjdwz1o0e1pBhGJUrKEsMPC7PtuqYyVqu7sXDKcst0cSoOVhsEKhmxRqVXzABTrU4s67uyaq1V4aOqqDnTLPvUWlvxsKa7bWCKGkSV.9dsbDBgpLr8mky1smsHNLIMwVCWjA9UUYPeDoezZR+WGbFUQ08c4PBfYBKUw0UCmyXuCDwrcgMwmwxlqjIFLmyzfJ1Ff5aqtjKqZbCOPEhbvNAfQHiecnpvB8QsHGUcQ9sS13E4gpMfNmLXQDUsp3mVwO2AvrVQwQqpHx3pkUuQ39JhM1LEwO.uYCg6t3Qbke35was0fWMQ7+X7le+xWfsxokfsAt+aezKSZrYMkef65VyEKsvE58Ff7TboB+5tRw4uvkRKIorDZJarbTDcY6LZbRD6M.dOfLMR5O2i+6rGpGkXgPWcDs0hkBVT11HasyFecq6idcK5MxEJt35KnpTNzAgGtH1CdDhOqWN5zcJ0zciV6NZaMewiIBLF+M7WtSWssStS2BmkhcngL0Mxz4lii7eibdhs1mYJxWM6VWDb+o7Fc6OOm8BmAlwFIiVlDJEbe8P1HJP5owxEBUAb+IZ1XJORS28VjAxxAWJ7ffMORyo9DVZlYheBtygv+.8enL.bsSepOTXWNhpkL1EqU5AhJK8P+6Hrqf0p7D8TT7HNaUBfXrQACdBm97YDMEdQG7HDs5ZMm5UTasLTsEzWVytNCxln85SiPSrR2vlSuJldqx4BNduyB1C5j2AC2.6htfKlbeQ+Kn2duwd+q8TrDMmE.N1EpGdyY2XKEUi5ASk4ZCAyPaWASUQwQ+u.EG+oFEckx4wTCaeqtl8SRuYL0OUdkuUtQSj9LyH.gRX9zilv2.A1j6d5AV2vfhgOE3Jees382.B+qOmi1hbNdKx4EaQNe6Vjy2sE478aQNu7QyQ+UXmtPIisRiv.iN2PtbbNWPAUeiTD5e.a.2O4
      

      Its just a simple code:

      const var ScriptFX1 = Synth.getEffect("Script FX1");
      const buttons = Content.getAllComponents("Button");
      
      for (x in buttons)
      	x.setControlCallback(onButtonControl);
      	
      inline function onButtonControl(component, value)
      {
      	// I Need to change the value of BTN3 to 1 if one of the buttons gets off
      	// and if both gets on, I Need to change The BTN3 to 0
      }
      
      Y 1 Reply Last reply Reply Quote 0
      • Y
        yall @Natan
        last edited by

        @Natan if
        ( value = o )
        {
        // Logic here //
        }

        NatanN 1 Reply Last reply Reply Quote 0
        • NatanN
          Natan @yall
          last edited by

          @yall Thank man,
          The idea is to set the third BTN to on when one of the buttons Turned off.

          Let's Suppose. BTN1, and BTN2 is On! ( in this scenario BTN3 is Off )
          If I switch BTN1 off, BTN3 turns on.
          and If I Switcdh BTN2 Off, BTN3 Stays Off.

          Does that make sense?

          1 Reply Last reply Reply Quote 0
          • NatanN
            Natan
            last edited by

            This is what i Try to achieve:

            		if (buttons[0].getValue() == 1)
            		if (buttons[1].getValue() == 1)
            		{
            			ScriptFX1.setAttribute(ScriptFX1.BTN3, 0);	
            		}
            

            and if One of the Buttons switched Off:

                          ScriptFX1.setAttribute(ScriptFX1.BTN3, 1);	
            
            ulrikU 1 Reply Last reply Reply Quote 0
            • ulrikU
              ulrik @Natan
              last edited by

              @Natan
              Try this

              inline function onButtonsControl(component, value)
              {
              	local Btn3Value = false;
              	
              	for (b in Buttons)
              		if (!b.getValue())
              			Btn3Value = true;
              	
              	Button3.setValue(Btn3Value);
              	Button3.changed();
              }
              

              Hise Develop branch
              MacOs 15.3.1, Xcode 16.2
              http://musikboden.se

              1 Reply Last reply Reply Quote 0
              • First post
                Last post

              8

              Online

              1.7k

              Users

              11.8k

              Topics

              102.3k

              Posts