How to listen to existing key events?

Place to get help with not working mods / modding interface.
jarcionek
Fast Inserter
Fast Inserter
Posts: 137
Joined: Thu Mar 10, 2016 11:26 am
Contact:

How to listen to existing key events?

Post by jarcionek »

I can define a control and then register an event listener to execute a script when user presses that key.

I would like to do similarly but for the base game controls - e.g. when user presses M to open a map.

Is there any way to achieve that or do I have to define my own control and ask the user to set both my control and the base game control to the same key?
Bilka
Factorio Staff
Factorio Staff
Posts: 3470
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: How to listen to existing key events?

Post by Bilka »

Link your custom input prototype to a game control using https://wiki.factorio.com/Prototype/Cus ... me_control. Then just treat it like any custom input in your event handling.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.
jarcionek
Fast Inserter
Fast Inserter
Posts: 137
Joined: Thu Mar 10, 2016 11:26 am
Contact:

Re: How to listen to existing key events?

Post by jarcionek »

Not sure how I missed that... Thanks a lot!
Post Reply

Return to “Modding help”