Page 1 of 1

custom input fails

Posted: Thu Nov 24, 2016 6:06 am
by osldgoth
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

Posted: Thu Nov 24, 2016 1:14 pm
by Choumiko
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)

Re: custom input fails

Posted: Sun Dec 04, 2016 10:41 pm
by aubergine18
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.

Re: custom input fails

Posted: Wed Dec 07, 2016 12:33 am
by osldgoth

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.
	  },
	}
)
I've used none, all, script-only, and game-only

Code: Select all

script.on_event("EMC-Hotkey", function(event)
		game.print("confirm")
	end
)
Nothing is ever printed.

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

Posted: Wed Dec 07, 2016 10:41 am
by Rseding91
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.

Re: custom input fails

Posted: Sat Dec 17, 2016 6:17 am
by osldgoth
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.
oh cool. I will revisit this when 0.15 comes out. Thanks.