Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Mr Jake on Sat 03/07/2004 19:19:38

Title: Problem with PauseGame
Post by: Mr Jake on Sat 03/07/2004 19:19:38
The problem being that the game doesnt pause :/

if (keycode==32){
Ã,  Ã,  if (IsGamePaused () == 1){
Ã,  Ã,  Ã,  Ã,  TintScreen (0,0,0);
Ã,  Ã,  Ã,  Ã,  GUIOff (6);
Ã,  Ã,  Ã,  Ã,  UnPauseGame();
Ã,  Ã,  Ã,  Ã,  }
Ã,  Ã,  Ã,  else {
Ã,  Ã,  Ã,  Ã,  TintScreen (50, 50, 100);
Ã,  Ã,  Ã,  Ã,  PauseGame ();
Ã,  Ã,  Ã,  Ã,  GUIOn (6);
Ã,  Ã,  Ã,  Ã,  }
Ã,  Ã,  Ã, }Ã,  Ã, 

This is inside 'on_key_press'
Title: Re: Problem with PauseGame
Post by: Ishmael on Sat 03/07/2004 19:57:01
Try:

     else {
        TintScreen (50, 50, 100);
        GUIOn (6);
        Wait(1);
        PauseGame ();
        }
     }   


Just a thought... You could also try without the Wait.
Title: Re: Problem with PauseGame
Post by: Mr Jake on Sat 03/07/2004 19:58:11
it was like that without the wait before but it didnt work, I will try the Wait now :D

EDIT: Na da, still no workie
Title: Re: Problem with PauseGame
Post by: Ishmael on Sat 03/07/2004 20:10:46
Don't ask where, but I gut this idea:

if (keycode==32) {
    if (IsGamePaused () == 0) {
        TintScreen (50, 50, 100);
        GUIOn (6);
        PauseGame ();
    } else {
        UnPauseGame();
        TintScreen (0,0,0);
        GUIOff (6);
    }
}   

I remember flipping the condition order helps a bit in some rare cases... or it's just me.
Title: Re: Problem with PauseGame
Post by: Mr Jake on Sat 03/07/2004 20:32:13
Nope :( didnt work :(

This is the current script:
if (keycode==32) {
Ã,  Ã,  if (IsGamePaused () == 0){
Ã,  Ã,  Ã,  Ã,  TintScreen (50, 50, 100);
Ã,  Ã,  Ã,  Ã,  GUIOn (6);
Ã,  Ã,  Ã,  Ã,  Wait (2);
Ã,  Ã,  Ã,  Ã,  PauseGame ();
Ã,  Ã,  Ã,  Ã,  } else {
Ã,  Ã,  Ã,  Ã,  GUIOff (6);
Ã,  Ã,  Ã,  Ã,  TintScreen (50, 50, 100);
Ã,  Ã,  Ã,  Ã,  Wait (2);
Ã,  Ã,  Ã,  Ã,  UnPauseGame ();
Ã,  Ã,  Ã,  Ã,  }
Ã,  Ã,  Ã, }Ã,  Ã, 


EDIT: I wont even tell you what the problem was, its too stupid :D
Title: Re: Problem with PauseGame
Post by: TerranRich on Sun 04/07/2004 00:30:37
What do you mean you won't tell us what the problem was? Is it fixed? If so, let us know so we can find you beat you down--- um, I mean edit your first post's icon to the thumbs-up. :P
Title: Re: Problem with PauseGame
Post by: Mr Jake on Sun 04/07/2004 08:04:05
[size=10] I forgot to comment out the 'If (IsGamePaused() == 1) keycode 0;' line [/size]
Title: Re: Problem with PauseGame
Post by: Scorpiorus on Sun 04/07/2004 18:36:05
In fact, it's not that stupid at all. These things can be difficult to think of since they are here in the script by default and as a result aren't paid much attention to.

A very similar problem I remember was with the 'handling inventory clicks in script' option - if it's ticked we can handle clicks by putting if(button==LEFT/RIGHTINV) code into the on_mouse_click but we usually add them after the if(button==LEFT/RIGHT) blocks which are inclosed within an if(IsGamePaused()==0) condition. Thus if an inventory GUi is set to PopupModal the inventory clicks won't work since IsGamePaused returns 1.