Hereās my global advice on this oneā¦ Any time youāre using the exact same lines of code in any program more than once, youāve got an opportunity to completely eliminate all of them but the first one.
So for example, these statements which are completely identical could be evaluated ONCE at the beginning of the piston and then the result could be stored into a Boolean variable.
Then rather than making this same comparison over and over again you just have a simple IF statement like this:
define boolean SomeoneCameHome
Make all your checks and then stuff the result into the variable
IF SomeoneCameHome is True Then
The other thought I have is if you have multiple ways for the same eventual thing to be true then rather than duplicate the same actions in this piston, call an external piston and put all the actions in it. Much like you are calling routinesā¦just call another piston.
But it does seem like you need to take a step back on this one and think about it from the perspective of, what triggers are going to cause an action to happen. Check for all of them at the beginning and if they are all true then do those actions. However, if there are actions which are only going to be done for one person and no one elseā¦then thereās nothing wrong with moving that one person out to their own pistonā¦and then again you can call the common stuff in a separate piston as needed.