<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[JavaScript trigger if]]></title><description><![CDATA[<p>Hello,</p><p>is it possible to work with triggers in the js actor?</p><p>Eg. output trigger by if statement or funktion triggered by input.</p><p>Best<br />Dill<br /></p><p></p><p></p>]]></description><link>https://community.troikatronix.com/topic/7368/javascript-trigger-if</link><generator>RSS for Node</generator><lastBuildDate>Fri, 15 May 2026 01:21:47 GMT</lastBuildDate><atom:link href="https://community.troikatronix.com/topic/7368.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 07 May 2021 20:50:00 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to JavaScript trigger if on Sun, 09 May 2021 06:11:47 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="https://community.troikatronix.com/uid/2066">@Juriaan</a>  exactly. I tend to output booleans as a way to read a trigger. If 1 send trigger, if 0 don't.</p>]]></description><link>https://community.troikatronix.com/post/46025</link><guid isPermaLink="true">https://community.troikatronix.com/post/46025</guid><dc:creator><![CDATA[DusX]]></dc:creator><pubDate>Sun, 09 May 2021 06:11:47 GMT</pubDate></item><item><title><![CDATA[Reply to JavaScript trigger if on Sun, 09 May 2021 11:14:26 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="https://community.troikatronix.com/uid/740">@dillthekraut</a></p>
<p>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. </p>
<p>What I do is the following;</p>
<ol><li>Create a variable in my main called response</li><li>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</li><li>Alter the response array based on the code in main / other functions</li><li>Return response array</li></ol>
<p>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.</p>
<p><a class="plugin-mentions-user plugin-mentions-a" href="https://community.troikatronix.com/uid/124">@DusX</a> 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 ?<br /></p>
<p><a href="/assets/uploads/files/1620510042450-isadora-bug-report-javascript-activate-scene.izz">JavaScript - Activate Scene issue</a></p>]]></description><link>https://community.troikatronix.com/post/46024</link><guid isPermaLink="true">https://community.troikatronix.com/post/46024</guid><dc:creator><![CDATA[Juriaan]]></dc:creator><pubDate>Sun, 09 May 2021 11:14:26 GMT</pubDate></item><item><title><![CDATA[Reply to JavaScript trigger if on Sat, 08 May 2021 21:21:59 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="https://community.troikatronix.com/uid/2066">@Juriaan</a> <br /><a class="plugin-mentions-user plugin-mentions-a" href="https://community.troikatronix.com/uid/2837">@timkelly</a> <br /></p>
<p>Thank you, this works for the input.<br />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?<br />These trigger outputs even when activating a scene or user actor without any intended rule to do so.<br />Therefore the only solution is, to go with integer 0/1 and a comparator connected.<br /><br />I remember a forum discussion and an explanation by Mark about this, but can´t remember the exact reason for it.</p>]]></description><link>https://community.troikatronix.com/post/46022</link><guid isPermaLink="true">https://community.troikatronix.com/post/46022</guid><dc:creator><![CDATA[DillTheKraut]]></dc:creator><pubDate>Sat, 08 May 2021 21:21:59 GMT</pubDate></item><item><title><![CDATA[Reply to JavaScript trigger if on Sat, 08 May 2021 15:39:43 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="https://community.troikatronix.com/uid/2066">@juriaan</a> oooh interesting - in which case this may be a bug?</p>
<p>See how trigger here is continually firing - while the trigger going through value changed (which is behaving correctly in this instance) is not?</p><img src="/assets/uploads/files/1620488381884-screenshot-2021-05-08-at-16.34.48-resized.png" />]]></description><link>https://community.troikatronix.com/post/46018</link><guid isPermaLink="true">https://community.troikatronix.com/post/46018</guid><dc:creator><![CDATA[timkelly]]></dc:creator><pubDate>Sat, 08 May 2021 15:39:43 GMT</pubDate></item><item><title><![CDATA[Reply to JavaScript trigger if on Sat, 08 May 2021 15:28:16 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="https://community.troikatronix.com/uid/740">@dillthekraut</a></p><p>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. </p><p>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.</p><img src="/assets/uploads/files/1620487559592-screenshot-2021-05-08-at-16.09.26.png" /><p>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</p><img src="/assets/uploads/files/1620487593116-screenshot-2021-05-08-at-16.19.23.png" /><p>There is probably a much more elegant solution (someone please hop in if so!), but this is what I've found to work well.</p><p>Tim</p>]]></description><link>https://community.troikatronix.com/post/46017</link><guid isPermaLink="true">https://community.troikatronix.com/post/46017</guid><dc:creator><![CDATA[timkelly]]></dc:creator><pubDate>Sat, 08 May 2021 15:28:16 GMT</pubDate></item><item><title><![CDATA[Reply to JavaScript trigger if on Sat, 08 May 2021 15:12:29 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="https://community.troikatronix.com/uid/740">@dillthekraut</a><br /></p><p>Could you tell us a bit more?</p><p>You can use a Trigger by using a <strong>mutated output </strong>(attach something with a Trigger to the output of the JavaScript actor)</p><p>Simply sending a 1 would fire the trigger.</p><p></p><p></p>]]></description><link>https://community.troikatronix.com/post/46016</link><guid isPermaLink="true">https://community.troikatronix.com/post/46016</guid><dc:creator><![CDATA[Juriaan]]></dc:creator><pubDate>Sat, 08 May 2021 15:12:29 GMT</pubDate></item></channel></rss>