Author Topic: Pause game function that overrides and stores blocking scripts  (Read 1555 times)

Today I was working on the UI for my game, specifically on the pause game function, and then it occured to me that it's actually not possible to make an on_key_press PauseGame() function that overrides a currently running blocking script.
This means that it's not possible to pause the game e.g. while a character is speaking.

I'm still very much a newbie regarding scripting and how blocking scripts work, so I have no idea how much work and rework would need to be done to implement such a function in AGS, and perhaps the function is not worth the amount of work, BUT;

I for one think it would be awesome if it'd be made possible in some future version of AGS to make an on_key_press PauseGame() function that overrides a currently running blocking script, and somehow stores the running script and the current "position" within that script, such that it can be resumed after UnPauseGame().

Crimson Wizard

  • Local Moderator
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    • Lifetime Achievement Award Winner
    • Crimson Wizard worked on one or more games that won an AGS Award!
    •  
    • Crimson Wizard worked on one or more games that was nominated for an AGS Award!
It is hard to say how easy that would be to implement user-scripted pause. Suspending script functions in the middle (aka coroutines) is something that would require big script overhaul, which may be unrealistic with our lack of human resources.

Probably there are less costly options, like adding "above-game" built-in pause that would just lock any game update.
« Last Edit: 08 Nov 2016, 14:48 by Crimson Wizard »

It is hard to say how easy that would be to implement user-scripted pause. Suspending script functions in the middle (aka coroutines) is something that would require big script overhaul, which may be unrealistic with our lack of human resources.

Probably there are less costly options, like adding "above-game" built-in pause that would just lock any game update.

I don't care how the function is realized, as long as it works :smiley:
A built-in "above-game" (or meta-something or whatever) pause function sounds great to me, and it seems to me that something like that would do the job just fine.
Such a function would be awesome in a future version!

monkey0506

  • SEND PIZZA.
    • Best Innovation Award Winner 2017, for his work to help AGS games reach the widest possible audience - through popular distribution platforms (Steam, Galaxy) as well as other operating systems (Android, Linux)
    • monkey0506 worked on one or more games that won an AGS Award!
    •  
    • monkey0506 worked on one or more games that was nominated for an AGS Award!
it occured to me that it's actually not possible to make an on_key_press PauseGame() function that overrides a currently running blocking script.
This means that it's not possible to pause the game e.g. while a character is speaking.

This is incorrect. You have unfortunately been misinformed.

PauseGame() function that overrides a currently running blocking script, and somehow stores the running script and the current "position" within that script, such that it can be resumed after UnPauseGame()

This is exactly how PauseGame/UnPauseGame currently works. See my reply in Beginners' Technical Questions. You were simply calling "IsKeyPressed" too often, without storing a "held" state of the key (which AGS doesn't do for you). There is actually a module for that, called KeyPressAlways.