Per the subject, I'm trying to delay a set of actions by setting a delay based on a variable (the same variable[integer] is also used to control the RM speak/notify behavior hence the math).
Why are the 'Delay actions' in the RM rule not delaying the subsequent speak/notify actions? I even set the delay to a fixed/decimal '10' to see if the variable was throwing it but it made no difference.
Logs will reveal this if the case, and I agree that they are a good idea to enable--but one guess without seeing those: is it possible the value of sonosTTSControlFlags changed multiple times while any of the delays were still pending? If so, they'll remain scheduled -- nothing in your rule cancels them -- and may therefore appear to make subsequent actions run sooner than expected (if your reference point is the latest trigger event).
I think I understand what's happening but the behavior is... questionable to me at least. As the actions in instance #1 affect the state of instance #1's trigger condition, the rule is re-triggered (instance #2 trying to run). The second instance either causes the first instance to do nothing or instance #2 appears to evaluate so quickly that it nullifies the TTS 'textTospeech' variable before the first gets a chance to execute it. I can handle this with yet another control flag but that's precisely what I was trying to avoid by overloading 'sonosTTScontrolFlags' in the first place.
Any thoughts/alternative approaches/guidance much appreciated.
Mark the delays as "Cancelable?" (it is an option on the delay action when you create or edit one), then use a "Cancel Delayed Actions" action somewhere else in your rule that make sense, perhaps as the very first action.
You could also consider "Wait for events: elapsed time" instead of "Delay," which is automatically canceled on re-trigger, but last I checked, that only allowed specified numeric values and not variable values.