Wintermute Engine > Technical forum

Stopping cutscenes

(1/1)

Banbury:
Hi,
how do I stop scripted cutscenes with a keypress? The key event doesn't respond while the cutscene is running. Do I have to place a 'Sleep' behind every function? Does the TimeSlice functions have something to do with it (I wasn't able to call it due to lack of documentation)?

Greetings

Banbury

Mnemonic:
The "Keypress" event should work no matter it a scripted sequence is running or not. I think the easiest solution would be to:

1) set up a global variable and set it to false before you execute the cutscene
2) in the "keypress" event handler set the global variable to true
3) in the cutscene script check for the value of that global variable every now and then and if it's true, then interrupt the script (by return or something...).

By calling the Sleep command, you return control to the engine. But methods like GoTo or Talk call the Sleep command automatically so you don't have to call it explicitly.

Banbury:
I tried to attach a script with my cutscene and then detaching in on a keypress. The event handler isn't executed though (tested it with a Msg).
I think it's a little messy to check at every line of my cutscene, if it has been canceled.

Greetings

Banbury

Mnemonic:
The "keypress" handler should be in a script that is attached to the Game object, because the Game recieves the keypresses.

And...yes, it is messy. But now that you mention it, detaching the cutscene script from the keypress handler should also work and it would be a much cleaner solution.

(Sorry, I can't test it right now)

Navigation

[0] Message Index

Go to full version