Pause game function that overrides and stores blocking scripts

Started by tor.brandt, Tue 08/11/2016 11:19:04

Previous topic - Next topic

tor.brandt

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

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.

tor.brandt

Quote from: Crimson Wizard on Tue 08/11/2016 14:39:36
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

Quote from: tor.brandt on Tue 08/11/2016 11:19:04it 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.

Quote from: tor.brandt on Tue 08/11/2016 11:19:04PauseGame() 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.

SMF spam blocked by CleanTalk