I am often in a situation where what I want a script or automation mode that is essentially “queue 1 call and keep only the most recent call.” A simple example is a script that sets the brightness of a specific light. If it is called multiple times in succession while still running, the ideal thing would be to finish the current call and then start a new call with only the most recent brightness rather than setting all the settings in between in sequence or, worse, dropping the most recent calls once a queue is filled.
Sometimes “restart” works for this purpose, but sometimes a script has other effects where it would be undesirable to cancel it. The difference between this and a queue of length 1 is that a second call while it’s still running is currently dropped, and I would like that call to replace the old one in the queue. You could generalize this to a “stack,” keeping the most recent n calls (analogous to a queue of length n). I don’t personally have many uses for stacks bigger than 1, but maybe others do, and this would work for my purposes.
And apologies if there’s a way to do this now and I just haven’t found it. Thanks!