# Wrong Sequence trig behaviour

**URL:** <https://forum.xod.io/t/wrong-sequence-trig-behaviour/5915>\
**Category:** XOD Programming Questions\
**Created:** [February 22, 2022, 8:46pm UTC](https://forum.xod.io/t/wrong-sequence-trig-behaviour/5915 "2022-02-22T20:46:19Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![rogmorin](https://avatars.discourse-cdn.com/v4/letter/r/85f322/32.png) [@rogmorin](https://forum.xod.io/u/rogmorin)\
**Post date:** [February 22, 2022, 8:46pm UTC](https://forum.xod.io/t/wrong-sequence-trig-behaviour/5915/1 "2022-02-22T20:46:19Z")

</div>

Hello,

Still working on my project , I solve some of the issue but still some sequence trig not expected. Even on the boot trig I find some of the last patch to been trig true.  
I have corrected the case where there was input without data to transfer in “if-else” node, or in “any” node type.  
I have also added a defer node between boot and "first “any” node.

 ![hydro2-main](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/2X/e/e42690af36a4e7c846576fa45a8f0648032ad419.jpeg)  
 ![event_drainage](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/2X/c/c768a5f4ad2faace8e02092e44eb5d283ba5c6db.jpeg)  
 ![event_transf-feed](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/2X/c/cddc2641a76b962ad2c3be9a9ea89440b05eb03e.jpeg)  
 ![event-pompe1-sonar-complet](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/2X/7/795be7948c7e2ac795c235a4f5bcbed15a45c106.jpeg)

Thanks

---

<div class="post-metadata">

**Author:** ![rogmorin](https://avatars.discourse-cdn.com/v4/letter/r/85f322/32.png) [@rogmorin](https://forum.xod.io/u/rogmorin)\
**Post date:** [February 23, 2022, 3:22pm UTC](https://forum.xod.io/t/wrong-sequence-trig-behaviour/5915/2 "2022-02-23T15:22:46Z")

</div>

Hello,

Does someone have any idea why some patch from my systeme trig prematurely on boot??

---

<div class="post-metadata">

**Author:** ![gweimer](https://avatars.discourse-cdn.com/v4/letter/g/a9adbd/32.png) [@gweimer](https://forum.xod.io/u/gweimer)\
**Post date:** [February 23, 2022, 4:38pm UTC](https://forum.xod.io/t/wrong-sequence-trig-behaviour/5915/3 "2022-02-23T16:38:25Z")

</div>

All patches will trigger during initialization. Most should return without doing anything if nothing needs done, but if a node executes code without first checking for changes of input values, that will execute on boot.

---

<div class="post-metadata">

**Author:** ![rogmorin](https://avatars.discourse-cdn.com/v4/letter/r/85f322/32.png) [@rogmorin](https://forum.xod.io/u/rogmorin)\
**Post date:** [February 23, 2022, 5:25pm UTC](https://forum.xod.io/t/wrong-sequence-trig-behaviour/5915/4 "2022-02-23T17:25:34Z")

</div>

So any idea on how i can avoid these trig, i have tried adding defer node and it does not seem to work.  
It is not acceptable that some pump start randomly.  
Regards,

---

<div class="post-metadata">

**Author:** ![gweimer](https://avatars.discourse-cdn.com/v4/letter/g/a9adbd/32.png) [@gweimer](https://forum.xod.io/u/gweimer)\
**Post date:** [February 23, 2022, 9:45pm UTC](https://forum.xod.io/t/wrong-sequence-trig-behaviour/5915/5 "2022-02-23T21:45:29Z")

</div>

They won’t start “randomly”…only when relay is turned on. If you are talking about SV4\_KB, it is always turned on, but you don’t always allow state to change, so it will never turn off. You probably want the input tied to ON rather than ACT. If there is a particular relay node that always initializes to wrong value at boot, then stabilizes after initialization, you could disable it by adding a delay node with delay-ACT tied to a ‘not’ node, then to relay-ACT so that the relay will not update until delay timer has expired.

There are a lot of places where you add if-else nodes that just return true/false or 1/0. There is no reason to do this since input fed to if-else-COND is already true/false, which is interpreted as 1/0 for numeric inputs. If you want to reverse the value (if-else-T = False), then use ‘not’ node rather than an if-else node. This will be more efficient and make your code easier to read.

You don’t provide all your code, so it is difficult to determine what else might be wrong since we can’t determine what all the inputs to each patch will be during initialization. This is complex enough, it would be better to attach a xodball of your project rather than images of each patch. It would also make it easier to debug if we knew exactly which parts are not doing what you expect; what do you expect & what is it doing?

---

<div class="post-metadata">

**Author:** ![rogmorin](https://avatars.discourse-cdn.com/v4/letter/r/85f322/32.png) [@rogmorin](https://forum.xod.io/u/rogmorin)\
**Post date:** [February 24, 2022, 4:01am UTC](https://forum.xod.io/t/wrong-sequence-trig-behaviour/5915/6 "2022-02-24T04:01:58Z")

</div>

Thank you for yopur comments. I would like to provide to you the code but i don’t know how to proceed.  
Sorry but I don’t understand what you mean by " attach a xodball".

Regards,

---

<div class="post-metadata">

**Author:** ![gweimer](https://avatars.discourse-cdn.com/v4/letter/g/a9adbd/32.png) [@gweimer](https://forum.xod.io/u/gweimer)\
**Post date:** [February 24, 2022, 4:14am UTC](https://forum.xod.io/t/wrong-sequence-trig-behaviour/5915/7 "2022-02-24T04:14:19Z")

</div>

There are two formats for saving your projects. The default is a .xodball file that is stored in your workspace. You can find your workspace by going into XOD and selecting File \> Switch Workspace. Attach your project file to your post to share it here.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/1X/eb7348baa04192c2ef932d1db54d44f09f8a7888.png) [@system](https://forum.xod.io/u/system)\
**Post date:** [March 26, 2022, 4:15am UTC](https://forum.xod.io/t/wrong-sequence-trig-behaviour/5915/8 "2022-03-26T04:15:13Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
