HISE Logo Forum
    • Categories
    • Register
    • Login

    How does builder.connectToScript() work?

    Scheduled Pinned Locked Moved Scripting
    5 Posts 3 Posters 244 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.
    • O
      Orvillain
      last edited by

      I have this code:

      inline function build_midi_script_processors()
      {
      	for (i = 0; i < max_count; i++)
      	{
      		local script_processor = builder.create(
      		builder.MidiProcessors.ScriptProcessor, "script_processor_" + i,  i+1, builder.ChainIndexes.Midi);
      		
                      builder.connectToScript(script_processor, "{PROJECT_FOLDER}/Scripts/ScriptProcessors/ghostalpha2/sampler_scriptprocessor_template.js");
      		
      	}
      }
      

      But I get this in response:

      script_processor_0:! onControl could not be parsed!
      script_processor_1:! onControl could not be parsed!
      script_processor_2:! onControl could not be parsed!
      script_processor_3:! onControl could not be parsed!
      script_processor_4:! onControl could not be parsed!
      script_processor_5:! onControl could not be parsed!
      script_processor_6:! onControl could not be parsed!
      script_processor_7:! onControl could not be parsed!
      script_processor_8:! onControl could not be parsed!
      script_processor_9:! onControl could not be parsed!
      script_processor_10:! onControl could not be parsed!
      script_processor_11:! onControl could not be parsed!
      script_processor_12:! onControl could not be parsed!
      script_processor_13:! onControl could not be parsed!
      script_processor_14:! onControl could not be parsed!
      script_processor_15:! onControl could not be parsed!
      

      I've tried all manner of different paths to the script, and nothing seems to be working.

      The script template itself is:

       function onNoteOn()
      {
      	Console.print('onNoteOn method');
      }
       function onNoteOff()
      {
      	Console.print('onNoteOff method');
      }
       function onController()
      {
      	Console.print('onController method');
      }
       function onTimer()
      {
      	Console.print('onTimer method');
      }
       function onControl(number, value)
      {
      	Console.print('onControl method');
      }
       
      
      O 1 Reply Last reply Reply Quote 0
      • O
        Orvillain @Orvillain
        last edited by

        @Christoph-Hart Could this be a bug? I followed the instructions on this page:
        https://docs.hise.audio/scripting/scripting-api/builder/index.html#connecttoscript

        O 1 Reply Last reply Reply Quote 0
        • O
          Orvillain @Orvillain
          last edited by

          Still finding issues with this. Anyone got a snippet that demonstrates connecting to a script via Builder.connectToScript ?

          1 Reply Last reply Reply Quote 0
          • F
            Fergler
            last edited by Fergler

            Same issue. Perhaps related, this also is not working:

            var test = builder.create(builder.MidiProcessors.ScriptProcessor, name, parent, builder.ChainIndexes.Midi)

            builder.setAttributes(test, {"Bypassed": 0, “Script”: #script contents# } );

            test becomes an object 0xEtc reference, but nothing can be set to it from setAttributes. I’m just wondering if both issues are related in a backend method.

            This method used to work in one of the 3.x versions, sorry I can’t be of more detail

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

              @Fergler yeah you can use this method with float attributes only.

              The connectToScript function is almost correct, but the reference does need to use the Scripts folder in its path:

              {PROJECT_FOLDER}ScriptProcessors/MyProcessor.js should work, however it‘s highly recommended to move the script out of this directory as it will be replaced on the next save.

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

              29

              Online

              1.7k

              Users

              11.8k

              Topics

              102.3k

              Posts