• Isadora
  • Get it
  • Forum
  • Help
  • ADD-ONS
  • Newsletter
  • Impressum
  • Dsgvo
  • Impressum
Forum
    • Categories
    • Recent
    • Popular
    • Tags
    • Register
    • Login

    Java String Array Output

    How To... ?
    2
    5
    1.8k
    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.
    • MaximeM
      Maxime
      last edited by

      Hello,

      I'm trying to adapt a little script I did in processing to receive a string through a single OSC address and store it in array to keep the last 6 values received.

      Then my final goal is to display this text in different way depending on its rank in the array (Most recent updates are bigger).

      In Isadora I figured I would use a Java script actor with one input and 6 outputs, each connected to a different text draw actor.

      I get the most recent value to be updated correctly (not really interesting 😄  ) but it seems to be a problem in my loop to shift the values in the array...

      Here is my JS code in Idadora, and attached my processing sketch sat_names.zip, if you can't understand what I want to do with my description...

      There might be some really silly obvious mistake that I can't figure out... (seems to be something weird with the definition of strings inside the fonction too)

      Thanks in advance for the hints and tips!

      var list = ["","","","","",""];
      function main()
      {
          for( var i=5;i>0;i--){
          list[i] = list[i-1] ;
      
      }
      list[0] = arguments[0];
      //list[1] = arguments[1];
      
        var output = [list[0],list[1],list[2],list[3],list[4],list[5]];
      return output;
      

      }

      MBP 15" end 2013 / i7 2,3Ghz /NVIDIA GT 750M 2048Mo / 16Go RAM / OS 10.10.3
      Razer Blade 15" 2018 /i7/ GTX1070/ 16Go RAM

      1 Reply Last reply Reply Quote 0
      • DusXD
        DusX Tech Staff
        last edited by DusX

        I would take a look at this page.

        https://www.w3schools.com/jsre...

        You probably want to do something like 'unshift' the new value to the front of the array and if the new array is greater than the total entries (length) you want.. 'pop' the end entry.

        Something like that anyway.. there are a few ways to approach the same results.

        Troikatronix Technical Support

        • New Support Ticket Link: https://support.troikatronix.com/support/tickets/new
        • Isadora Add-ons: https://troikatronix.com/add-ons/
        • My Add-ons: https://troikatronix.com/add-ons/?u=dusx

        Running: Win 11 64bit, i7, M.2 PCIe SSD's, 32gb DDR4, nVidia GTX 4070 | located in Ontario Canada.

        1 Reply Last reply Reply Quote 0
        • MaximeM
          Maxime
          last edited by

          Ok I actually found out that my code was working...

          I just need to connect every output of the JS actor to a text actor. If the outputs are not connected, they are not actives and are not showing anything...

          MBP 15" end 2013 / i7 2,3Ghz /NVIDIA GT 750M 2048Mo / 16Go RAM / OS 10.10.3
          Razer Blade 15" 2018 /i7/ GTX1070/ 16Go RAM

          DusXD 1 Reply Last reply Reply Quote 0
          • DusXD
            DusX Tech Staff @Maxime
            last edited by

            @Maxime

            Yes. The outputs are mutable and default to numbers. The green color shows that they can be mutated to other data types. (Text, javascript doesn't support video etc..)

            Connecting the green colored output pin/ball to a text input will change/mutate the output to match.

            Troikatronix Technical Support

            • New Support Ticket Link: https://support.troikatronix.com/support/tickets/new
            • Isadora Add-ons: https://troikatronix.com/add-ons/
            • My Add-ons: https://troikatronix.com/add-ons/?u=dusx

            Running: Win 11 64bit, i7, M.2 PCIe SSD's, 32gb DDR4, nVidia GTX 4070 | located in Ontario Canada.

            MaximeM 1 Reply Last reply Reply Quote 0
            • MaximeM
              Maxime @DusX
              last edited by

              @DusX Thank you for the precision.

              I knew it was mutable, but somehow thought it would still show up...

              I guess that's the kind of mistake you do only once! 🙂

              MBP 15" end 2013 / i7 2,3Ghz /NVIDIA GT 750M 2048Mo / 16Go RAM / OS 10.10.3
              Razer Blade 15" 2018 /i7/ GTX1070/ 16Go RAM

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