Im sorry, but i was unable to solve this by myself. Adding some features to the game, i decided add a custom GUI when the player pauses the game called gCustomPause which have visible set to popupmodal.
So, at Keypress, when players press"P" i add gCustomPause.Visible = True;
But, even when the game do not process clicks or keyboard inputs and all animations stopped (only the button in the GUI to close it responds) the game still is working; The game still works in the background, and i can see that the clock is still runing ??? (internal clock routines are in the RepExec section)
But, if i change the gCustomPause.Visible = True for Display ("Pause, press any key to continue...") everything in the game stop (even the RepExec routines)
How i can obtain that when i call the gCustomPause? I check all the manual and the forums and i was unable to find something similar. And its supposed that a popup GUI pauses the game when you call it from a script.
Thanks for any help.
JpSoft
Try calling PauseGame ()?
Quote from: SSH on Thu 01/05/2008 16:59:08
Try calling PauseGame ()?
It do not work. It have the same effects as the popup GUI :(
Im trying to create a function to pause the game with noloopcheck but I'm a little confused on how it works.
function noloopcheck gamepause();
{
bool finish_pause; // Determines if the pause finish or not
finish_pause = false;
while (gCustomPause.Visible == false)
{
if (gCustomPause.Visible == false) finish_pause = true;
}
}
This works to stop the game processing events and still keeps the animation in the gCustomPause, but nothing happens when you click the button to close the GUI (i guess because the game is in a loop)
Any help with this?
JpSoft
AFAIK repeatedly_execute shouldn't be run during blocking events anyway, but you could try encasing your rep_ex function inside this condition:
if (IsGamePaused() == 0) {
// ...
}
This is regarding using PauseGame because you shouldn't need a custom function such as this. If need be it may be made easier like this:
function repeatedly_execute() {
if (gCustomPause.Visible) PauseGame();
else UnPauseGame();
if (IsGamePaused() == 0) {
// stuff
}
}
Or even just by-pass the pausing step and use:
function repeatedly_execute() {
if (gCustomPause.Visible == false) {
// stuff
}
}
This last code-snippet relies on AGS's built-in system of pausing while pop-up modal GUIs are shown, but all of them should have the same effect.
Quote from: monkey_05_06 on Sat 03/05/2008 20:51:04
AFAIK repeatedly_execute shouldn't be run during blocking events anyway, but you could try encasing your rep_ex function inside this condition:
if (IsGamePaused() == 0) {
// ...
}
Rep_exec works even if the game is paused, i have it very clear now (at least, when the game is paused using GamePause() or any popup GUI) But all the game engine stops totally with a single "Display" call.
I will try encasing the rep_exec; that section have +1000 lines of code and i must check if there are anything i want just continue working even when the players call a pause.
Thanks for the idea.
Jp
All the game engine works with this sentence:
in Rep_Exec:
second_loops++;
if (second_loops == 39) seconds++;
I fixed the trouble just adding this
if (iIsGamePaused == 0) second_loops++;
Thanks monkey for your colaboration. I were very stuck with this since i believed that the popup GUIs pauses ALL the game
Jp