assurance-tunnel
assurance-tunnel
assurance-tunnel
assurance-tunnel

Java String Array Output



  • 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 :smile:  ) 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;
    

    }


  • Tech Staff

    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.



  • 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...


  • Tech Staff

    @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.



  • @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! :)


Log in to reply
 

Looks like your connection to TroikaTronix Community Forum was lost, please wait while we try to reconnect.