currently Im looking for a way to wait for a specific event in a sequence: codepad.org/1GeLwpvP
If I made no misstake CWaitInterval seems to ignore to state completely. Pausing and then resuming a 0.1 WaitInterval does not work either. Did I miss something? Is there a other way to finsih a Wait prematurely? Is it possible to change the duration?
You are trying to use an interval for a purpose beyond its intended design. Intervals aren’t meant to be dynamic in duration like this; and although you can extend an Interval’s behavior through subclassing, it would be a bit more complex than what you are doing here.
That is the interface for controlling a playing interval from outside. It doesn’t work that way from within the interval itself.
When you embed an interval within a Sequence, it doesn’t really play the interval directly. Instead, only the outermost Sequence is “playing”; and all of the intervals nested within it are invoked (but not “played”) in the appropriate order. This is all a very sophisticated system designed to optimize the playback of complex intervals. You can’t call finish() on a deeply nested interval, because nested intervals aren’t in a playing state.
What you’re trying to do can very naturally be expressed in two functions, without even using the task system: