How to disable a rule from a Blockly script?

Thank you so much, this works just fine.

But I’m having second thoughts about moving various rules (i.e. rules that are only needed under certain circumstances) into Blockly scripts. Those thoughts don’t concern functionality but rather efficiency (and, if you wish, code aesthetics). Looking at the script below, I wonder how resource intensive this loop is when it checks the state of two items every second.

I assume that the loop that is built into the core of OH3 and which is checking for events that trigger rules is running at a much higher frequency, so checking every second is probably rather slow. So depending on how the two sloops relate to each other, I may even be saving resources compare to doing the same using two rules, but I have no clue, really.

I just have a feeling that this could be done in a more elegant way, e.g. if events could be “pushed” into the script, as it were, instead of it constantly checking.

So, to ask a question that may be relevant to also for other users: What would be some rules of thumb when implementing an event-based “trigger” in a Blockly script, i.e. a loop that waits for an event/ change of state?

The first rule is, of course: don’t check the state more often than necessary for the purpose at hand. But what else should one consider?

For example, I suppose there is no difference between the loop above and the following one (using until instead of while?