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

Navigation

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

    Javascript Triggers

    How To... ?
    3
    3
    1285
    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.
    • GertjanB
      GertjanB Beta Platinum last edited by

      Hi,

      I'm currently updating all my old user actors with a lot of math to one javascript actor.
      In this i found a challenge if i want to trigger some code at a specific time.
      or give an output trigger
      I wondered if there is a command to look at a trigger input and to send a trigger output?
      I now did it like this
      **Input Trigger:**

      var Triggervalue=9999;

      function main(){

      if(arguments[0] != Triggervalue){

      //Do something

      Triggervalue=arguments[0];}

      }

      This works when you attach a toggle actor in front of it.
      **Output Trigger**

      var Triggertrue = 0;

      function main(){

      //if (something happens){Triggertrue==1;}

      if (Triggertrue ==1){

      array[0]=100;

      Triggertrue =0;}

      }

      This works when you attach a comparator =100 to it.
      Is there a better way?

      www.gertjanbiasino.be

      1 Reply Last reply Reply Quote 0
      • m_theater
        m_theater last edited by

        for me the code depends on the rest of the functionality,  but attached is a basic patch

        the "input trigger approach" doesn't work with a trigger that's why i placed a macro in front
        @mark the js actor is input is mutable, but if we change it to an trigger input it still performs like a number input (no auto reset to false or 0) is it a bug or has it something to do that there is no "timbase" in a js actor

        876c81-js_trigger.izz

        avk4.net

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

          You need to remember that the JS will run everytime any input is received, and will output to all outputs.

          I find it most useful to use the JS actor in combination with other actors to form a user actor.
          One approach I have taken before is to use JS to work out the logic for a number of states, and simply output a number that represents the state.
          Followed by a Selector, or comparator or etc... to do whatever is needed. This can work well also for multiple outputs where the state defines which outputs should be used next.
          The JS actor is not meant to replace the native Isadora actors, but to rather enhance their usage and offer some additional functionality. (see: the javascript sort() function)

          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