Problem with pop-ups

Hi, I have a problem with pop-ups.
The idea is that when the player presses the escape key, a pop-up window will appear with a menu of options (return to the game, exit the game, save game, etc.)
Depending on the button that the player presses, he performs a direct action, for example “return to the game”, he simply hides the pop-up window.
Depending on whether another button presses the action, it would be to exit another superimposed pop-up window with new options, for example, if you click on the “exit game” button, a confirmation window should appear with the options to exit, return or save game.
The problem arises when the player clicks on one of these buttons that should show the second pop-up window, it does not work.
Attached game menu screen, to see if someone sees something that is not right, I suppose that the error is when it comes to nesting the events, but I have tried several alternative ways and there is no way that it works

The problem is that you’ve embedded the events for the pop up windows under the escape key pressed conditions that only get run once.

As your events currently stand, to process botonsalirdeljuego2, 3 things must happen simultaneously - the escape key needs to be pressed, botonsalirdeljuego needs to be clicked and botonsalirdeljuego2 needs to be clicked. All at the same time. And this will never happen.

The solution is to move the last 3 groups (Salir del juego sin guardar, Salir sin guarder and Volver al juego) to all be in line with the very first event (that checks if the escape key is pressed).

Then add one extra condition to each button click check event, that checks the button is also visible. Something like :

Hello, I have aligned everything, just as you indicated, but now, when pressing the “escape” key it does not work, the menu does not appear, what could it be due to?
I attach a screenshot of the entire Start Menu, as it is now

Yes, because you are hiding the buttons a few events further down (did you get too eager undenting?)

Indent the highlighted event :

Well, I already made the indentation of the highlighted event, just as you have indicated.
The escape key now works again, but pop-ups still don’t work when exiting or saving the game.
I can’t quite see what the error is, maybe I should look for other types of events to do it, like text boxes or something like that. I’m going to keep turning it around, thanks for your help

Consider using layers for your menus. Make a layer for each popup menu, and place the buttons for each popoup menu on that layer. Then you just need to show or hide a layer, rather than each and every button.

It means you can then use the event condition that checks if a layer is visible, and have the button actions as sub events.

It’ll reduce the number of event actions in the event sheet, make it more readable, reduce the chance of introducing bugs and make it a lot simpler to add or remove buttons or other objects to the menu

Hello MrMen, first of all thanks for your interest in my problem.
I have changed the events as I have understood you have suggested.
I attach a screenshot of the events as they have now.
When I hit the “Escape” key, the main menu appears, and the direct event keys (return to game, load game and new game) work correctly, however, the “exit game” and “Save game” buttons They should show the following pop-up, they don’t work, they don’t do anything, apparently, although when I load a game it recovers the game the moment I hit the save button.
I can’t quite understand what I’m doing wrong.

Well, nothing, there is no way, I have done a lot of tests, I have even created 3 different external events, and placed the pop-up in 3 different layers, if someone comes up with a solution, it will be appreciated, I do not understand that is what I’m doing wrong, I can’t see it, but it must be some nonsense, it can’t be that complicated to make an exit submenu with 3 options and a save game with 2 options

One problem I see is that you are creating new objects on the layer every frame it’s visible. At least use trigger once on the event :



But, more importantly, why are you creating these objects in events? Why aren’t you creating them in the editor.

Or, if must be in events, with the condition “At the beginning of the scene” that’s not under the layer visibility check, but at the top of all the events.

I explain a little more.
The game starts with a very simple starting menu:
Load game

The game contains more than 100 playable screens, that is, more than 100 scenes, at the beginning of a new game it goes to the “starting scene”
I do the menu within the game by external events so as not to have to place the menu objects in each of the more than 100 scenes, I simply copy the external event at the beginning of each scene

now I have chosen to create an external event for the main menu and two events for the two submenus

In the end it turns out that now it works worse, any button I press takes me out of the game, I am desperate, if I am not able to make a menu with two submenus, how am I going to create a game as complex as this one that I am doing?

This sounds like it’s the perfect candidate for creating the menus as external layouts and instantiate them in a “beginning of scene” event in your menu’s external event.

I think the way this thread is heading, it’s going to take a long time to sort this out. If you could zip up your project and share it, either in this thread or in a PM, and we can sort it out and let you know what was done. It may be the fastest way.