Pause Game

Started by , Mon 23/06/2003 20:17:52

Previous topic - Next topic

Cat142

When I pause the game and use the lucasarts gui "Walk to" textbox, I want to display a text message when the game is pauzed, I used this :

if (IsGamePaused()==0)
     {
        string buffer;
        string madetext;
        int cur_mode;
        StrCopy (madetext, "");


        PauseGame();
        StrCat(madetext, "Game Paused, press spacebar to continue. ");
        SetLabelText (1, 10, madetext);
        /* GUIOn(1); */
        /* DisableInterface(); */
        SetCursorMode (8);
        SetMouseBounds(160, 100, 160, 100);
       
        }
  else
     {
        string buffer;
        string madetext;
        int cur_mode;
        StrCopy (madetext, "");
         
         UnPauseGame();
         GUIOn(1);
         EnableInterface();
         SetCursorMode (0);
         SetMouseBounds(0, 0, 0, 0);
         SetCursorMode (MODE_WALK);
         StrCat(madetext, "Walk to ");
         SetLabelText (1, 10, madetext);
     }

The pause text pops up 1sec and then the textbox goes black, does anybody know how to solve this ?

Thanks,

Cat

Cat142

if (IsKeyPressed(32)==1)  Is offcourse before this script...     ;D

Proskrito

#2
im not sure, but you could try to write that in the on_key_press function in the global script, something like this:

on_key_press(int keycode){//dont rememeber the exact name
if (keycode == 32){
if (IsGamePaused.....
...
else...
}

and put that before the "if (IsGamePaused()==1) keycode=0;" statement

EDIT: i think IsKeyPressed returns 1 only if you are pressing the key, so when you release the space bar, the "else" statement is run. (im not sure, tough)

Cat

Quote from: Proskrito on Mon 23/06/2003 21:26:43
im not sure, but you could try to write that in the on_key_press function in the global script, something like this:

on_key_press(int keycode){//dont rememeber the exact name
if (keycode == 32){
if (IsGamePaused.....
...
else...
}

and put that before the "if (IsGamePaused()==1) keycode=0;" statement

EDIT: i think IsKeyPressed returns 1 only if you are pressing the key, so when you release the space bar, the "else" statement is run. (im not sure, tough)

I think that's the issue, when you release the spacebar the statement is changed and the text dissapears..

is there no keyword like if gamepaused == 1 then ...
that it only looks if the game is paused and handle accordingly...

Scorpiorus

Maybe the next is what you want... :P

function repeatedly_execute() {

if (IsGamePaused()) {

  if (IsKeyPressed(32)) {
 
    string madetext;
 
    UnPauseGame();
    GUIOn(1);
    EnableInterface();
    SetCursorMode (0);
    SetMouseBounds(0, 0, 0, 0);
    SetCursorMode (MODE_WALK);
    StrCat(madetext, "Walk to ");
    SetLabelText (1, 10, madetext);
  }
  else {
   
    string madetext;
 
    StrCat(madetext, "Game Paused, press spacebar to continue. ");
    SetLabelText (1, 10, madetext);
    SetCursorMode (8);
    SetMouseBounds(160, 100, 160, 100);
  }

}

}

-Cheers

SMF spam blocked by CleanTalk