Updates to piston not taking effect: need to clone piston every time?


#21

@WCmore I get lost in some of your more loquacious posts… :sweat_smile:

What (in pseudocode) is your suggestion in the end? Is it this?:

EVERY day at 4am 
    compute {alarmTime}
End EVERY

IF Time happens daily at {alarmTime}
    set {morningScene}
End IF

#22

Sorry… my words never seem able to do my brain justice. LOL
(Believe it or not, my posts here are greatly simplified)

Usually, I avoid answering complex question to new users, because there is so much basic webCoRE understanding that should come first… but somehow, I ignored that policy with you. :grin:


If you use EVERY blocks to set a time variable, then there needs to be a dummy block prior to the real event. If we reduce my Rocket Launch piston to the bare structure, we get this:

Every 12 hours
    Compute and Set variable {nextLaunch} to something
END EVERY

IF Time happens daily at ($hour24+1)":00"
    Then write to log
END IF

IF Date & Time happens daily at {nextLaunch}
    Then do cool stuff
END IF

The first block runs twice a day, gathering data and setting the {nextLaunch}.
(it ignores anything outside the EVERY block)

The second block runs hourly, and basically is the “Fake” timer, which updates the schedule.
(it runs top to bottom, ignoring the EVERY block)

The third block, is the real event.
(it also runs top to bottom, ignoring the EVERY block)


So the EVERY block is a great way to insert a “mini-piston” inside of another piston… as long as we keep in mind that each event only looks at part of the piston.


#23

Sorry, I should have elaborated…

One of the tricks in my repertoire is to place commands outside of any trigger blocks.
(meaning certain commands run at each execution… except for EVERY triggers)

This also lets me do some fancy juggling, since WAITS no longer need to check any preexisting conditions afterwards…

I can no longer do this when I drop the EVERY block.


As always with webCoRE, there are ways around this, but coding with or without an EVERY block is quite different.


#24

You could always add an ‘exit’ to make a particular timer act like an EVERY block but, of course, order of blocks would be important.

Agreed!