• Products
    • Isadora
    • Get It
    • ADD-ONS
    • IzzyCast
    • Get It
  • Forum
  • Help
  • Werkstatt
  • Newsletter
  • Impressum
  • Dsgvo
  • Press
  • Isadora
  • Get It
  • ADD-ONS
  • IzzyCast
  • Get It
  • Press
  • Dsgvo
  • Impressum

Navigation

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Tags

    JavaScript trigger if

    How To... ?
    4
    7
    941
    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

      Hello,

      is it possible to work with triggers in the js actor?

      Eg. output trigger by if statement or funktion triggered by input.

      Best
      Dill

      Juriaan timkelly 2 Replies Last reply Reply Quote 0
      • Juriaan
        Juriaan Tech Staff @DillTheKraut last edited by

        @dillthekraut

        Could you tell us a bit more?

        You can use a Trigger by using a mutated output (attach something with a Trigger to the output of the JavaScript actor)

        Simply sending a 1 would fire the trigger.

        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

        timkelly D 2 Replies Last reply Reply Quote 1
        • timkelly
          timkelly @DillTheKraut last edited by

          @dillthekraut

          javascript actor will accept triggers but it only sees them as a boolean, so you to wrap everything in an if statement so that it only runs that code when it's true. 

          this is especially important if you have multiple inputs (your trigger, and another value that changes more often), as the javascript actor will run every time it receives inputs.

          likewise for trigger outputs - you can output to a trigger, but if you have one constantly changing argument the trigger will be firing constantly also - but this can be solved by running it through a value changed actor and using the trigger output of that

          There is probably a much more elegant solution (someone please hop in if so!), but this is what I've found to work well.

          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
          • timkelly
            timkelly @Juriaan last edited by timkelly

            @juriaan oooh interesting - in which case this may be a bug?

            See how trigger here is continually firing - while the trigger going through value changed (which is behaving correctly in this instance) is not?

            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 0
            • D
              DillTheKraut @Juriaan last edited by DillTheKraut

              @Juriaan
              @timkelly

              Thank you, this works for the input.
              But an output allways triggers if any of the inputs are changed, despite any code there is. Even without any code at all. I guess this is the same issue there is, with the Global values actors?
              These trigger outputs even when activating a scene or user actor without any intended rule to do so.
              Therefore the only solution is, to go with integer 0/1 and a comparator connected.

              I remember a forum discussion and an explanation by Mark about this, but can´t remember the exact reason for it.

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

                @dillthekraut

                Hi! This is the case, the JavaScript actor will send a value to the entire output array. So even when you don't actively return anything you will still receive a value. The only solution at the moment is Comp for Trigger outputs and sending a 0 at all times. 

                What I do is the following;

                1. Create a variable in my main called response
                2. Set all the values to a default value that I'm sending. For triggers, this is a 0. For other values, this might be a loop through of my input vars, etc
                3. Alter the response array based on the code in main / other functions
                4. Return response array

                I tried to create a User actor with some JavaScript inside it and do some quick test, but I could not repro the scene switching behaviours. What I could repro is the Activating scene issue that you are describing.

                @DusX could you look into the attached Izzy file and let us know or this is behavoir that is expected ? Press 'r' to reset (or use the button in the Control panel) and use 'j' to jump to the next Scene. What we see is that in the counter / output we get a '1', should be zero. Since we didn't actively trigger it right ?

                JavaScript - Activate Scene issue

                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

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

                  @Juriaan  exactly. I tend to output booleans as a way to read a trigger. If 1 send trigger, if 0 don't.

                  Troikatronix Technical Support

                  • New Support Ticket Link: https://support.troikatronix.com/support/tickets/new
                  • My Add-ons: https://troikatronix.com/add-ons/?u=dusx
                  • Profession Services: https://support.troikatronix.com/support/solutions/articles/13000109444-professional-services

                  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
                  • First post
                    Last post