Hello everyone, I’m currently developing a UI app for BeamNG.drive and am looking for a way to programmatically send a keypress from the app into the game. Specifically, I need to simulate a keypress event (such as pressing a specific key) within the game environment. Has anyone had experience with this, or does anyone know if it's possible through the game's Lua API or any other method? I'm open to different approaches, whether it’s directly simulating the keypress or triggering the action that is normally bound to that key. Any guidance, advice, or pointers to relevant documentation or examples would be greatly appreciated! Thank you in advance for your help!
Sure, it's very simple. On the Javascript side of things, you will want to listen to a keypress. Once you have the key, you can send it to Lua via: Code: bngApi.engineLua("your_extension.myFunction(" + key + ")") // your_extension could be any game extension, it's just an example Hopefully this helps
What do you mean by "simulating a keypress"? I was able to get this working for my mod by following these docs: https://documentation.beamng.com/modding/input/ And reverse-engineering by referencing the stereo system mod: https://www.beamng.com/resources/stereo-system.17581/ If you're talking about programmatically doing what one of the built-in keybindings does, you can find exactly what code is being called in these files: lua/ge/extensions/core/input/actions/*.json