I would like to create an ingame menu which pops up after some time of player inactivity. How could I go about making something like this?
You want a menu to open after the player is inactive for a while. You can do this relatively easily. Instead of trying to detect if the player is moving, or if something is happening to the player, we can instead check to see if any input devices are being used. If not, we can make a timer increase until a certain value, when a menu will appear.
In this logic setup, I have an always sensor with true level triggering, sending a positive pulse every tic to the property actuator "Add to Timer" This means that every logic tic, the property "Timer" is increased by 1. When the property "Timer" is equal to 3600, it broadcasts the message, "Open Menu" I chose the value 3600 here because by default, the BGE is set to 60 logic tics per second. 60 tics per second times 60 seconds for a minute of inactivity is 3600 tics. Now is the interesting part - I have a whole bunch of sensors connected to an "or" controller, which then assigns "Timer" to 0. I have a keyboard sensor set to all keys, and a whole bunch of mouse sensors. If any input is received from the mouse or the keyboard, the timer will reset. Only if the player is not pushing any buttons or doing anything with the mouse will the message "Open Menu" be sent.
Of course, if you are using a different method to control your character, such as a joystick, you will need to use a joystick sensor also attached to the "or" controller. You essentially want any input that could control something in your game to also reset the timer. I am using an "or" controller because if it receives a positive pulse from any of the connected sensors, it will send a positive pulse to the connected actuators. If I used an "and" controller here, you would need to be pushing a key on the keyboard, as well as moving the mouse, clicking the left and right mouse buttons, scrolling, and pushing the middle mouse button. Using the "or" controller here, any input will reset the timer.
This logic setup only broadcasts the message "Open Menu" once there has been 60 seconds of inactivity. You still need to make your menu, and have it open upon receiving the message "Open Menu" This as simple as using a message sensor, with the subject filled in as "Open Menu"
You can see a working example here. While you are pressing any key or doing anything with the mouse, Suzanne will shake her head. After 60 seconds of not using the mouse or keyboard, the game will pause and the inactivity menu will open.