Yes, good idea. There are some questions around what happens after the wait is canceled, that I think even .mos didn't resolve. Is just the wait canceled and the script resumes after the wait, in this case going immediately to Undo? Or does it cancel the entire "main" part of the script leaving only the OnRepeat to do it's thing then end?
I can imagine variables to test this:
wait loop
if waitCanceled {
...
}
else {
...
}
Or arguments to cancel to specify how much of a cancel to do:
CancelWait(continue=true)
Or maybe just a few functions to spell it out:
CancelAndContinue
CancelAndEnd