Community Forum

Is it possible to raise inputActionEvents?

Forum Overview >> Scripting

Created10.09.2021 21:07

Martin Eller (Jason0611) 10.09.2021 21:07
Hi there,

I'm currently writing on a mod to realize headland management and I'm nearly done with it.
But while simplifying the code and always being a friend of clearly defined interfaces, it would make everything much easier if some function could be triggered by the corresponding inputActionEvents.

Is it possible to raise inputActionEvents from a Lua script? I didn't find any hint of it in the documentation, but maybe I've overseen something?


Bilbo Beutlin (BBeutlin) 10.09.2021 23:13
You'll get much easier infos if you install the Giants Remote Debugger, which comes with the LUA source codes in .zip archives. Extract these and you can search very comfortably eg. with Notepad++ "search in files" for certain keywords and phrases.

So by these searches you'll find many examples for usage of 'raiseEvent' or 'InputAction'.

Anyway, raising inputActions by script is bad programming style. You never know what a user has assigned to certain actions. Also mods may change something.
Way better is using the 'raiseEvent' where you can exactly define which action (function) should be executed.

Martin Eller (Jason0611) 11.09.2021 00:07
Thank you for your reply.

That's exactly the way I want to go: Not using some keybindings, but trigger the inputActions behind the keys. Something like "inputActionEvent("xyz").raiseEvent()". Actually I realized all functions using and calling in-game-functions or in-mod-functions.

I know that is not as easy as in my example, but I wonder if it would be possible at all.

Note: Log in to post. Create a new account here.