HISE Logo Forum
    • Categories
    • Register
    • Login

    Reference to self

    Scheduled Pinned Locked Moved Scripting
    6 Posts 2 Posters 1.3k 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.
    • d.healeyD
      d.healey
      last edited by

      I think I remember mentioning this somewhere else but I can't find it so decided to create this thread. I want to know what the best solution is to this situation:

      const var scriptIds = Synth.getIdList("Script Processor");
      const var scripts = [];
      
      for (s in scriptIds)
      {
      	scripts.push(Synth.getMidiProcessor(s));
      }
      

      With this script I get this message Script Processor:! onInit: Line 6, column 14: You can't get a reference to yourself! How should I avoid this? Currently I'm using some regex to check if the MIDI processor name matches s but this means I have to change the regex comparison (script name) every time I use it in a different script. Is there a better way?

      Free HISE Bootcamp Full Course for beginners.
      YouTube Channel - Public HISE tutorials
      My Patreon - HISE tutorials

      1 Reply Last reply Reply Quote 0
      • Christoph HartC
        Christoph Hart
        last edited by

        Well the obvious fix is to not include the calling script processor in the list (it has no use anyway). No need to fiddle with Regex here.

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

          How do I do that? Please enlighten me sensei.

          Free HISE Bootcamp Full Course for beginners.
          YouTube Channel - Public HISE tutorials
          My Patreon - HISE tutorials

          1 Reply Last reply Reply Quote 0
          • Christoph HartC
            Christoph Hart
            last edited by

            I was talking to myself :)

            I'll need to change the function...

            1 Reply Last reply Reply Quote 1
            • Christoph HartC
              Christoph Hart
              last edited by

              Should be fixed now.

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

                Thank you!

                Free HISE Bootcamp Full Course for beginners.
                YouTube Channel - Public HISE tutorials
                My Patreon - HISE tutorials

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

                14

                Online

                2.0k

                Users

                12.7k

                Topics

                110.2k

                Posts