I have learned/dabbled in several different scripting and programming languages during my career. Some I have picked up with my google foo, and others I have had more formal training paid for by my employer. I think one of the challenges for new programmers/scripters is to be able to think like a computer. It can be straight forward to understand each individual command/concept in an isolated example, but building these up into more complex useful scripts can be a challenge for someone new to this. For example just looking at my boil kettle I can monitor and react to a boil over, loss of boil, or incorrect boil intensity without much effort. But to write a script to do that requires you to be able to think like a computer as to how to accomplish the same things in a linear, one command at a time fashion. Taking a high level concept and directly implementing it with low level code can be a challenge for both novice programmers writing simple code as well as experienced programmers writing complex code. Instead, It can be very helpful to take a top down approach. Starting with a flow chart for a state machine and then moving to pseudo code comments before writing any code can be very helpful to break down the high level concepts into more manageable sub-blocks that are eventually further reduced into actual code.
The example flow chart in the site below has corresponding code with comments for a few different languages.
https://www.geeksforgeeks.org/an-introduction-to-flowcharts/
So for the example above of wanting to temporarily disable the alarm during temperature ramping, I would start by creating a flow chart that represents the state machine as it is coded now. I would also add comments to your code that represent the blocks in the flow chart so you can bounce between them. Then I would modify the flow chart for the new functionality, add new comments to the code, and finally add the code itself.
View attachment 649868
Here would be the flow chart as the code exists above. (Note multiple if statements that are evaluating if we are at day 5). In case anybody wants to know, I used Lucidchart to make this flow chart.
View attachment 649867
Edit: to sum this all up, using the approach I mentioned will help a new scripter to be able to break down their scripting problems into more targeted questions in the forum. Looking at a long script that someone else wrote is difficult to follow, whereas smaller more targeted questions/examples are easier to review and provide feedback on.
In addition we all tackle large problems in different ways. To be honest I didn't even look at oakbarn's script above because the description of what he is trying to do sounds way too conviluted and non KISS to me. I'm not saying that there is no merit to it or that what he is trying to accomplish is wrong, but I'm not going to spend the time to try and understand the entirety of it all and provide feedback on how it was implemented in a script. It's like asking me to be your editor for a BYO article. I can help with simple grammar, but not the vision of your article.