Forum

    • Register
    • Login
    • Search
    • Categories

    Reference to self

    Scripting Forum
    2
    6
    731
    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.healey
      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?

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

      1 Reply Last reply Reply Quote 0
      • Christoph Hart
        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.healey
          d.healey last edited by

          How do I do that? Please enlighten me sensei.

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

          1 Reply Last reply Reply Quote 0
          • Christoph Hart
            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 Hart
              Christoph Hart last edited by

              Should be fixed now.

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

                Thank you!

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

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

                11
                Online

                732
                Users

                5.4k
                Topics

                50.2k
                Posts