HISE Logo Forum
    • Categories
    • Register
    • Login

    Help with scripting

    Scheduled Pinned Locked Moved Scripting
    16 Posts 3 Posters 664 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.
    • G
      Gudru
      last edited by

      Hello, i have a question. I made a viewport with a list in it, and I want to print out to the console what entry is selected in the viewport. How would I do this?

      1 Reply Last reply Reply Quote 0
      • d.healeyD
        d.healey
        last edited by

        In the control callback you can use Console.print(value)

        Libre Wave - Freedom respecting instruments and effects
        My Patreon - HISE tutorials
        YouTube Channel - Public HISE tutorials

        G 2 Replies Last reply Reply Quote 0
        • G
          Gudru @d.healey
          last edited by

          @d-healey it only shows me the numbers from 0 to 2 depending on what it selects out of three options

          d.healeyD 1 Reply Last reply Reply Quote 0
          • d.healeyD
            d.healey @Gudru
            last edited by

            @Gudru Do you have the list items in an array? If so you can use the value as an array index.

            Console.print(myArray[value]);

            Libre Wave - Freedom respecting instruments and effects
            My Patreon - HISE tutorials
            YouTube Channel - Public HISE tutorials

            G 2 Replies Last reply Reply Quote 0
            • G
              Gudru @d.healey
              last edited by Gudru

              @d-healey sorry if my question was vague I am trying to see the name of the entry selected @d-healey oh no, it is just set in items in properties, looking in the functions, can I use get function?

              1 Reply Last reply Reply Quote 0
              • G
                Gudru @d.healey
                last edited by

                @d-healey yes! I saw another post using get(“items”) to get list of items in viewport, I tried printing out and it gives me a list of all entries

                1 Reply Last reply Reply Quote 0
                • G
                  Gudru @d.healey
                  last edited by

                  @d-healey but do you know how I can use the get items to print the selected entry, not all?

                  d.healeyD 1 Reply Last reply Reply Quote 0
                  • d.healeyD
                    d.healey @Gudru
                    last edited by

                    @Gudru Yeah I just showed you that in my last post :p

                    You get the items in an array and then you use the value as the index.

                    Libre Wave - Freedom respecting instruments and effects
                    My Patreon - HISE tutorials
                    YouTube Channel - Public HISE tutorials

                    G 1 Reply Last reply Reply Quote 0
                    • G
                      Gudru @d.healey
                      last edited by

                      @d-healey it does not work, I get api call with undefined parameter 0

                      d.healeyD 1 Reply Last reply Reply Quote 0
                      • d.healeyD
                        d.healey @Gudru
                        last edited by

                        @Gudru Show me your code

                        Libre Wave - Freedom respecting instruments and effects
                        My Patreon - HISE tutorials
                        YouTube Channel - Public HISE tutorials

                        G 1 Reply Last reply Reply Quote 0
                        • G
                          Gudru @d.healey
                          last edited by

                          @d-healey

                          HiseSnippet 832.3ocsUslaSDCD1NIKpY4gnHN.q5uRkBUIPoTIDhPyCTDz1HRoBIDpxcWmDqrq8JausDg5cgKD2.NDbCfwd2jrglVphn9eyiuY973YF2SJ7oJkPhvkOZRLEgumS+Ib8nliHLNpaKD9AN6STZpzKU0dShIJEM.gwEeqQAtbIj87qWuGIjv8oyUgPGKX9z2yhX54Z603crvvNj.5Qrnbducit9BdSQnHA3SQmZnXh+XxP5ADiaEbP36zNfoEx9ZhlpP3R6IBlzej3bdp+GyTrSCoFg5n9PfRU2QDFXXrQKp4HVXPuo2aEBhRu4UghoUgG6rOKfMS+7pwCsF7liHe8.WXQ5UbA5UOO8pkidKgR3bTpTJkV2ouujEqmawvm65zkCONCHPYOOUR8EU3GXmlBvCtdqHxXZGIHLCQkcedspd6Tq1luz0EJ8Js2YDo2wL54wBott2q7lBdHU2TDEK3fPkMl4wFFjt4ASjRxD.3LWLPqrASSiTVuY7PFm5MHg6qYBtmfOyUSxjhvJ9SyTUHjgIzMc+laYvnRDR2JVx.JXSymsV+BD0Kf.+Oo5VJiEaJZRBCOEZtpb4rCQKG2NPnoGxqXYf6Etd+soACVpsrXERkK0rouWdc.qvShNkJye+MNBMCK1g4b0cX4G.7SKM4bTv6xY5Cio7qZr.kUOMciYrBbUa6EeTVuHMXZ0CwBLMiyJlHKwysInA5icaQzjogChLjsXpTyLWDbK5YvlhzV8xNsnpwZQr02rmRDdsabx+5rD2f1XxbVDzHQAaiTPvvErsjlvAURcUWgrp6D1XppJ5bVfdDTbweGvLhxFNRaj9oc40kFLgUBhfjPhdw8DlkiYFfm1EFNMCfbESOI+xy+aKOtoTbcmdLs+nkywBKgivS2sAGyV4dem1CFP80yIXImNe51Y+J5ChDMiObehVxflEmCRh5C+53Sgry4zPynEtfYHHUtlQ1TA5S4AVgeCmLi0Mx3Li0mZDEQ7khS7SGcLK0WypA3D29eVY3iUP1a1rhiSsspghf+WNw22b8eBLWtbLOcEv7rU.y1q.lmuBX1YEv7hU.ytWKFyW6uIQKhRGG.E8Za2Ygws4Dnyx1Eh9CFSihRC

                          1 Reply Last reply Reply Quote 0
                          • d.healeyD
                            d.healey
                            last edited by

                            Don't call your array, array, because that's a type.

                            The get("items"); returns a string. You need to convert it to an array using split().

                            const var Viewport1 = Content.getComponent("Viewport1");
                            
                            const var items = Viewport1.get("items").split(",");
                            
                            inline function onViewport1Control(component, value)
                            {
                            	Console.print(items[value]);
                            };
                            
                            Content.getComponent("Viewport1").setControlCallback(onViewport1Control);
                            

                            Libre Wave - Freedom respecting instruments and effects
                            My Patreon - HISE tutorials
                            YouTube Channel - Public HISE tutorials

                            G 1 Reply Last reply Reply Quote 0
                            • G
                              Gudru @d.healey
                              last edited by

                              @d-healey wow! Thank you very much david!

                              LindonL 1 Reply Last reply Reply Quote 0
                              • LindonL
                                Lindon @Gudru
                                last edited by

                                @Gudru whats wrong with

                                const var Viewport1 = Content.getComponent("Viewport1");
                                
                                
                                inline function onViewport1Control(component, value)
                                {
                                	Console.print(component.getItemText());
                                };
                                

                                HISE Development for hire.
                                www.channelrobot.com

                                d.healeyD 1 Reply Last reply Reply Quote 0
                                • d.healeyD
                                  d.healey @Lindon
                                  last edited by

                                  @Lindon I didn't see that function in the API browser for viewports. Does it work?

                                  Libre Wave - Freedom respecting instruments and effects
                                  My Patreon - HISE tutorials
                                  YouTube Channel - Public HISE tutorials

                                  LindonL 1 Reply Last reply Reply Quote 0
                                  • LindonL
                                    Lindon @d.healey
                                    last edited by

                                    @d-healey said in Help with scripting:

                                    @Lindon I didn't see that function in the API browser for viewports. Does it work?

                                    0h viewport, sorry I was thinking of ComboBox....

                                    Link Preview Image
                                    HISE | Docs

                                    favicon

                                    (docs.hise.audio)

                                    HISE Development for hire.
                                    www.channelrobot.com

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

                                    45

                                    Online

                                    1.7k

                                    Users

                                    11.7k

                                    Topics

                                    101.9k

                                    Posts