Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: BorisZ on Sun 12/09/2004 16:23:25

Title: Closing GUI on load sucess
Post by: BorisZ on Sun 12/09/2004 16:23:25
Hi
How can I be sure that user will load the game, and not cancel loading. I have GUI that I am closing after user presses load. But if user presses cancel on load screen, GUI is off and there is a blank room.
Thanks!
Title: Re: Closing GUI on load sucess
Post by: Scorpiorus on Sun 12/09/2004 17:12:45
I'm not quite sure what you are after but if you really want to force the user load a game just remove the cancel button from the GUI.

Or what behaviour do you want when the user presses "cancel"?
Title: Re: Closing GUI on load sucess
Post by: Albert Cuandero on Sun 12/09/2004 17:40:22
I think using a command to return the player to the room they came from would solve this.

For my load GUI (Interface 2) I use:

else if (button == 2) { //Resume playing
Ã,  Ã,  InterfaceOff (2);
Ã,  Ã,  SetDefaultCursor();
Ã,  Ã,  }


However if I get the player to an extra room first (like a map, or a book) I use this:


if (interface == 3) { //return
Ã,  Ã,  if (button == 0) {
Ã,  Ã,  Ã,  NewRoomEx (character[ GetPlayerCharacter () ].prevroom, character[ GetPlayerCharacter () ].x , character[ GetPlayerCharacter () ].y);
Ã,  Ã,  Ã,  InterfaceOff (3);
Ã,  Ã,  Ã,  }
Ã,  Ã,  }


Does it help?
Title: Re: Closing GUI on load sucess
Post by: BorisZ on Sun 12/09/2004 22:13:50
All the answers I got are related to custom load game GUI, but I am using built-in load game gui.
Is there a way to check if user has loaded the game and then do something (remove custmo GUI) and when he presses cancel, it does nothing (all with built-in load GUI)?
Title: Re: Closing GUI on load sucess
Post by: Scorpiorus on Sun 12/09/2004 22:25:21
Yes, there is a global on_event function that can be used to catch the load event:

// main global script file

function on_event (int event, int data)  {

    if (event == RESTORE_GAME)
    {
        // code just after the game is restored
        GUIOff(...);
    }

}