Teleport to the previous point?

Hello! I put you in context, I have made a menu with events on a map. What I would like to do is, teleport to that map to access that menu, if possible, when wanting to exit that menu, return to the same point where I accessed the menu.

Example: I am on the "forest" map and when I press ESC, I teleport to the "Menu" map, and when using the exit option in the menu, return to the same point that was on the "forest" map.

I do not know if I have explained well what I am trying to say, is it possible to do something like that?
Before entering the menu map, use control variables to set variables to the player X, player Y, and map ID respectively.

After exiting the menu map, used the stored variables to determine where the player should be teleported to.
Oh! It's works! Thank you!

I had not noticed that in the teleport option variables could be chosen.

Now I can do better things!

Original thread: https://forums.rpgmakerweb.com/threads/teleport-to-the-previous-point.142190/