Make Javascript (scheduler?) wait until a Task object is done repeating
Trevor being Trevor
Mar 18 2023 | 6:31 am
//Some half Pseudocode that hopefully makes sense of my problem var isNotDone = true; var waitCounter tsk = new Task(repeater_function, this) tsk.interval = 100; function repeater_function(){ //do a task eqivalent to sending a note value out an outlet waitCounter++ } while(isNotDone){ *** a bunch of code *** if(certain condition is true){ tsk.repeat(20); while(waitCounter < 20){ // do not pass go, do not collect 200 dollars, // i.e. do nothing until tsk.repeat(20) is done } } ***more code below*** }
I need to delay a series of events, hence the task object, but I also need to make sure the rest of the code waits until that series of events is complete to move on to the code below. Is there a way to do that without creating an infinite while loop as I have done above? I can't seem to find a way to accomplish this at least without a fundamental rebuild of how the rest the code is structured.
I am willing to use other methods such as Max Externals, but I need to access the Live API. As always, any advice is greatly appreciated!