Cannot Add Statements to my IF clause


#1

When I hit the add button, the pop up window goes away and then the new condition/statement does NOT appear. I also had large chunks of code simply dissappear when dragging them to other locations. The original piston was written yesterday but then I changed the design. I used drag and drop on some pieces which worked fine and then one chunk just went away.

So I am trying to add this bit:

To the the position I marked in the piston. This IF statement should have been inserted but nothing happens. I tried adding other more simple device commands and the same problem. I also cloned the piston and have the same problem with the new one. The below snapshot is while I am in edit mode and after I hit the ADD button on the above attempting to insert this where the arrow is. I was able to edit other pistons no proble and I was also able to add to other parts of the piston in an IF block that appears before this one.

ANd here is the error messages in the log:

image

Thanks for the help.


#2

The logs look like they come from the piston start event (so whenever you save an edit). Something is breaking as it traverses the piston code. Full logs might provide more of a clue what. It could conceivably be related to your other issues.

I’d be tempted to create a new piston from scratch, tedious as it is, though others might have a better suggestion. As things stand with your piston, you don’t need the ‘else if’ chaining as you have exclusively used trigger conditions and only one of them will be true. Separate ‘if’ blocks will work fine.


#3

This reminds me of

I don’t believe there was any resolution to this. Once the editor had corrupted the piston data there was no way to fix it without recreating the piston from scratch. The errors you’re seeing are due to corruption of the compressed data backing the piston, the smart app can’t make sense of something in that data.


#4

Yes…I ended up deleting the whole IF section and recreating it. It was the only way. I had all the above problems. It would not save new Statements and I added a 2nd condition in 1 place but the AND or OR was not visible either…muy strange.

Thanks.


#5

In my old (very old) days of coding…ELSE IF was always preferred instead of independent IFs. That way the code worked it’s way down from the top until it found a match and then exited without having to test the remaining conditions. So we put the most frequent conditions at the top. With individual IF statements, each one had to always be tested…Old habits when memory and processor capacity were very small.:wink:


#6

I still think it is good style. I just find that gets trumped by the piston editor being so utterly tedious to use …