Right now, I'm using a global variable for a certain task. There's three layouts at work here for a simple "Return to map" option in a pause menu. 1) The world map layout, 2) The pause menu layout, which runs on a modal layout object, and 3) The current stage itself.
I've had to use a global variable to do this. On the stage the player is on, they pause. This freezes everything on the stage as the menu is brought up because it's a modal layout object. Upon selecting, "Return to map", a global variable is set to 1. Then the modal closes, and there's an event sheet on the stage itself that states, "If this global variable = 1, go to layout World Map".
If I had a global function object, would that be able to replace using a global variable? Since global objects are a constant that never really go away, the modal layout could close, but the global function object could still be giving orders to return to the world map, right?
The only reason I've used a global variable is because if I remember correctly, I couldn't go from one layout to another with the modal still running, and if I had an event on the pause menu to close the modal layout, and THEN go to the world map, it wouldn't happen, because the modal layout would already be closed before that command in the line.