custom input fails

Place to get help with not working mods / modding interface.
osldgoth
Long Handed Inserter
Long Handed Inserter
Posts: 93
Joined: Thu Feb 26, 2015 3:52 am
Contact:

custom input fails

Post 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?
Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Re: custom input fails

Post 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)
User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: custom input fails

Post 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.
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.
osldgoth
Long Handed Inserter
Long Handed Inserter
Posts: 93
Joined: Thu Feb 26, 2015 3:52 am
Contact:

Re: custom input fails

Post 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.
Rseding91
Factorio Staff
Factorio Staff
Posts: 15234
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: custom input fails

Post 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.
If you want to get ahold of me I'm almost always on Discord.
osldgoth
Long Handed Inserter
Long Handed Inserter
Posts: 93
Joined: Thu Feb 26, 2015 3:52 am
Contact:

Re: custom input fails

Post 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.
Post Reply

Return to “Modding help”