Cancel an event whilst its running

My dialogue will type itself out letter by letter using the ‘Typewriter2’ event.
When i press the button at the top i want the text to show in full (which it does), but it then continues the typewriter effect still.

How do i stop this?


Hi @hognoze0 ,
It could be that the reason the text keeps typing out after pressing the button is because the loop doesn’t stop. Even though you’re showing the full text at once with SkipText2, the loop in Typewriter2 , specifically the For Each With Delay , keeps running, and you should stop that loop when the SkipText2 event is called.
Hope it works!!

Yess if I change the ‘each with delay’ to ‘completed’ instead of ‘loop body’ it does stop. How would i do that through code on the button press event?

You can set a Boolean textSkipped after SkipText2, and Add a branch after LoopBody to check is textSkipped is equal to True.

You will then need to set textSkipped to False again when starting to print the next line though. That depends on how you manage several lines of dialogues. It could look like this:

You should consider adding For Each loop with Break to your logic, so you can stop the typing without relying on Boolean flow. Something like this:

I’m not familiar with Each with Delay, is it a custom macro?

I’d tried using the skip boolean before but it was just in the wrong place, thanks so much!!

Also yes it was a custom macro that i made ages ago which is why i forgot how a lot of this code works haha

1 Like