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

    JavaScript wrong incrementation

    How To... ?
    4
    7
    182
    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
      DillTheKraut
      last edited by

      Hi,

      can somebody explane, why this is incrementing 'tactCount' by 2 instead of one?

      var tactCount = 0;

      function main() {
      var beatNum = arguments[0];

      if (beatNum == 1) {
              tactCount++;
              }

      return [beatNum, tactCount];
      }


      Thank you
      Dill

      timkellyT 1 Reply Last reply Reply Quote 0
      • timkellyT
        timkelly @DillTheKraut
        last edited by timkelly

        @dillthekraut

        Hi,

        This code seems to work for me (tested in this patch).


        I would hazard a guess that something in your patch is meaning that your beatNum value is being sent twice (the javascript will run whenever is receives input, even if it is identical to the prior input).

        A potential way to do a quick and dirty fix would be to stick a 'value changed' actor infront of your javascript actor like so, this will stop the duplicate value being passed onto the javascript:

        Tim

        Theatre Lighting & Projection Designer & Creative Technologist | www.timothykelly.co.uk

        Mac Mini (2018), 3GHz intel Core i5, 32GB RAM, Intel UHD Graphics 630 1536 MB // MacOS 11.3 Big Sur + Isadora 3.0.8

        Macbook Pro (Retina, 13", Early 2015), 2.7GHz Intel Core i5, 8GB RAM, Intel Iris Graphics 6100 1536 MB // MacOS 11.3 Big Sur + Isadora 3.0.8

        1 Reply Last reply Reply Quote 1
        • JuriaanJ
          Juriaan Tech Staff
          last edited by Juriaan

          Edit; Sent the wrong reply to the wrong thread. Oops!

          I just tested this on Windows 10, Isadora latest stable (3.0.8f12) works as expected if you just have a JavaScript actor / with the code provided above.

          Regarding your example;

          I think that you still receive values, but the Comparator that you put in place that only triggers when a 1 is coming in should fix that. So for sure, this is a weird one that may require us to look with you into the patch.

          Isadora 3.1.1, Dell XPS 17 9710, Windows 10
          Interactive Performance Designer, Freelance Artist, Scenographer, Lighting Designer, TroikaTronix Community moderator
          Always in for chatting about interaction in space / performance design. Drop me an email at hello@juriaan.me

          DusXD D 2 Replies Last reply Reply Quote 0
          • DusXD
            DusX Tech Staff @Juriaan
            last edited by

            There is a known bug in Isadora 3.0.8 that might have caused this behaviour. Entering a value by typing it into the Output of an attached actor (where the output is connected to the input of the JS actor) will cause the code to run twice. This behaviour is corrected for the next release.

            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.

            D 1 Reply Last reply Reply Quote 3
            • D
              DillTheKraut @DusX
              last edited by DillTheKraut

              @dusx

              I guess this was what I just found out. Not 100% sure though.
              There is a connection "loop", starting on an js actors output, passing a comparator and some other, and (only at special circumstances) changing an input value of the very same js actor. But it influences the behavior even if there is no "trigger".


              See the captures:

              Edit: wanted to add a gif, but it doesn´t show up.
              I try to explane: If I cut the connection between js actor output 4 and comparator on the right, everything works like expected. Keeping the connection, results in the ill behavoir, even if there is no change at output 4 (stays at 0), and the Trigger Value actor in the left stays inactive.

              1 Reply Last reply Reply Quote 0
              • D
                DillTheKraut @Juriaan
                last edited by

                @juriaan

                Thank you for your explanation, but I guess, this was meant for my other thread?

                JuriaanJ 1 Reply Last reply Reply Quote 0
                • JuriaanJ
                  Juriaan Tech Staff @DillTheKraut
                  last edited by

                  @dillthekraut

                  You were right; edited my Post.

                  Isadora 3.1.1, Dell XPS 17 9710, Windows 10
                  Interactive Performance Designer, Freelance Artist, Scenographer, Lighting Designer, TroikaTronix Community moderator
                  Always in for chatting about interaction in space / performance design. Drop me an email at hello@juriaan.me

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