custom input fails
custom input fails
I tried to set up a custom-input using the key "M", but the game completely ignores it. I've tried all 4 consuming values to no avail. I wanted to do stuff when opening/closing the map. does anyone know why this is?
Re: custom input fails
The only reason i can think of is that Factorio consumes the input and therefore the event is never fired (I assume Factorio processes input before it they get passed on to mods)
- aubergine18
- Smart Inserter
- Posts: 1264
- Joined: Fri Jul 22, 2016 8:51 pm
- Contact:
Re: custom input fails
Did you use "M" or "SHIFT + M" ?
Also, check that you event handler is using the correct name as defined in the custom-input prototype.
Also, check that you event handler is using the correct name as defined in the custom-input prototype.
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.
Re: custom input fails
Code: Select all
data:extend(
{
{
type = "custom-input",
name = "EMC-Hotkey",
key_sequence = "M",
consuming = "script-only"
-- 'consuming'
-- available options:
-- none: default if not defined
-- all: if this is the first input to get this key sequence then no other inputs listening for this sequence are fired
-- script-only: if this is the first *custom* input to get this key sequence then no other *custom* inputs listening for this sequence are fired. Normal game inputs will still be fired even if they match this sequence.
-- game-only: The opposite of script-only: blocks game inputs using the same key sequence but lets other custom inputs using the same key sequence fire.
},
}
)
Code: Select all
script.on_event("EMC-Hotkey", function(event)
game.print("confirm")
end
)
I've confirmed that the hotkey is indeed M in options>controls>mods
I was hoping a dev would let me know why M doesn't work with custom input.
Re: custom input fails
It's because there's a previous control (open map) registered with M and it blocks the input from reaching the custom control.
I re-ordered the input registrations for 0.15 so custom inputs always get checked first.
I re-ordered the input registrations for 0.15 so custom inputs always get checked first.
If you want to get ahold of me I'm almost always on Discord.
Re: custom input fails
oh cool. I will revisit this when 0.15 comes out. Thanks.Rseding91 wrote:It's because there's a previous control (open map) registered with M and it blocks the input from reaching the custom control.
I re-ordered the input registrations for 0.15 so custom inputs always get checked first.