Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Intangible on Tue 14/06/2011 00:56:23

Title: Using escape to cancel any "demo"
Post by: Intangible on Tue 14/06/2011 00:56:23
In "professionally" made AGS games like AGD's King Quest remakes, the escape key can be used to skip most demo sequences, "snapping" the main character into the room and position he'd be at if he had actually gone through the whole demo. How is this accomplished? If I have a sequence of commands for moving characters and making them say things, how can I allow the escape key to interrupt all that and put people in their final positions?

It seems like I'd have to put something in the global script's on_key_press event that always checks for Escape, and then does a bunch of things instantly if it's pressed (it would also have to know what "demo" is currently running).

Is that all there is to this trick of programming Escape to skip demos, or is there something a little more "native" in AGS that I can use?
Title: Re: Using escape to cancel any "demo"
Post by: ddq on Tue 14/06/2011 01:30:35
What you're talking about is a cutscene and AGS supports them well.
Look up StartCutscene and EndCutscene in the manual. What you're trying to do can be accomplished by...

StartCutscene(eSkipESCOnly);
// Code you want in the demo, such as talking, moving, etc...
Endcutscene();
Title: Re: Using escape to cancel any "demo"
Post by: Intangible on Tue 14/06/2011 13:22:32
Niiiice! I was hoping this would be built-in somewhere. Thanks for pointing me to it.