Custom console commands

Place to get help with not working mods / modding interface.
Post Reply
erisco
Burner Inserter
Burner Inserter
Posts: 17
Joined: Sun Aug 16, 2015 1:13 am
Contact:

Custom console commands

Post by erisco »

From what I can tell, there is no way to receive mouse or keyboard events with a mod. Also there is no way to poll for the keyboard or mouse state per game tick. I am trying to find some way to activate the function of my mod. If those options are not available then the next best thing I can think of is to let the player toggle the function on and off using the in-game console. However, I cannot figure out how to add a custom console command -- it may also be impossible.

Thanks for your help.

erisco
Burner Inserter
Burner Inserter
Posts: 17
Joined: Sun Aug 16, 2015 1:13 am
Contact:

Re: Custom console commands

Post by erisco »

I found that with "Script Interfaces" (see https://forums.factorio.com/wiki/inde ... interfaces) you can also use the interface from the in-game console. In this way the player can communicate with your mod. However, it is unfortunately verbose, especially since the ideal solution is a single key press or button click.

Additionally, game.local_player is not defined when the player issues a remote.call from the console.

GopherAtl
Fast Inserter
Fast Inserter
Posts: 177
Joined: Sat Jan 31, 2015 7:54 pm
Contact:

Re: Custom console commands

Post by GopherAtl »

You can also add custom guis, which many mods do. Can't actually override the gui that opens when you click a building, but you can create guis that are always visible, or that are created when the player is in proximity to something and removed when they leave.
My Mods:
Nixie Tubes - numeric displays for your circuit networks!
Logistic Combinators - use logistics values in circuit logic! -
Autowire - automate red/green wire connections

Post Reply

Return to “Modding help”