Stopping/Cancel Yield Instructions

function DialogTut()

{

thetargetinfo.dialogmessage=Control0;

yield WaitForSeconds(5.5);

thetargetinfo.dialogmessage=Control1;

yield WaitForSeconds(5.5);

thetargetinfo.dialogmessage=Control2;

yield WaitForSeconds(10.5);

thetargetinfo.dialogmessage=Control3;

yield WaitForSeconds(20.5);

thetargetinfo.showdialog=false;

thetargetinfo.dialogmessage="";

}

before anyone asks… yes i formatted the code. im posting from a google browser(which I’m told there’s a bug or something preventing correct formatting).

Is there anyway I can cancel a function like this mid run?
the reason I ask is because if the player triggers two functions like this, the later function won’t finish passing on the needed info.
I was looking up coroutines but it doesn’t really seem like what I need. I tried using them but it didn’t prevent the problem.

Err…after/before each wait check a parameter and if conditions met do a return?

I hate to bring up an old post, but if anyone is interested, one way is to cancel the coroutine from update or the like.(I made a tutorial on it available here) Hope it helps somebody!