Hi. Amateur ksp programmer here using SublimeKSP, and I have hit a roadblock in a piano script I am doing...
In order to script re-pedal events (ie, rapid pedal press after release that "catches" a sustaining note and maintains it instead of fast decaying), I have scripted the normal release decay as a succession of 4 fast tcm.wait() and fade_out commands that create an exponential decay of the sample (instead of the non-piano like linear decay of the regular fade_out...). Those tcm.wait and fade_outs are set inside a taskfunc that is triggered for each note release. So far so good and the release decays sound as good as release samples.
However, for scripting the re-pedalling I need to stop that taskfunc whenever there is a change in the #CC value of the pedal, so that a new faster or slower fade_out() command overrides the ongoing fade_out. However, I cannot find a way to "kill" a particular taskfunc... I am storing the taskfunc CALLBACK_ID in a array and I use that information to stop_wait(CALLBACK_ID, 1) the remaining tcm.wait() commands in that instance, but that does not block the remaining fade_outs from being executed. Is there something like exit(CALLBACK_ID)? Is there a work-around I am not thinking about? Any help is appreciated...