I have a sequence of print strings and i want to be able to stop them when i press a button, how do i do it?

In this example i have the keyboard event 1 going into the strings i want to play. If i press 2 i would like all of it to stop from whatever point it is at, and then i would like to resume it by pressing 2 again.
This will be in line with a video, so id like to add the pause functionality, but im just not a blueprints guy really, but i try. I have been stuck for a few days so i decided to ask for help, any is appreciated.

BTW this is just an example not the real thing, but its really close itd transfer 1:1 to what im doing.

You could try creating a bool variable and a branch node; using it like a switch. So when 1 is pressed you could set the bool to true, if it’s true print the strings. Then when 2 is pressed you could set the bool to false so the print strings would stop.

I’m not sure about the pause functionality, i’ve never used it, but I imagine you could say ‘if bool is false - pause’ then when 1 is pressed again and sets the bool to true - unpause/play.

Could you give an example of that? I dont really know how to set it up…

Having another look you could maybe look at using a gate node. A gate will stop the execution flow if something feeds into its ‘Close’ pin. So in this example below when you press 1, every frame ‘Hello’ will be printed out. When you press 2, it will stop the flow. Maybe that can help you a bit :slight_smile:

It has some issues with the delay node though, is there a way you can do what you’re trying to do without it? As for directly pausing the function I imagine you could keep track of where the execution currently is by setting some variables but that’s hard to describe without a wee bit more detail.

Alright perfect ill try it out!