Jump to content

Recommended Posts

I've been writing a mod that just uses a keydownhandler so it's called whenever z is pressed:

GLOBAL.TheInput:AddKeyDownHandler(GLOBAL.KEY_Z, function()
...
end)
 

I've been looking for a way to make this configurable for the user in-game, preferably from the controls screen. If this is possible does anyone know how or know of another mod that does this?

About time we had a topic addressing this. I have at least 3 mods installed (including your "Sort Inventory") that add key shortcuts, and I keep getting confused which keys I can bind and which I can't. It also causes the game to crash if those keys are pressed in the game's menus.

 

I'd love to help on this one, but LUA coding is still new to me. I'm still adjusting to syntax nuances between scripts, functions, and modules. It's a lot to take in at once.

 

What I have found so far (and I'm guessing this is either already known or no help at all but here goes):

 

don't_starve/data/scripts/screens/controlsscreen.lua contains a local kbcontrols{} and local controllercontrols{} array to handle the tagging of the controls in the customize screen. Not much, but it's a start ... perhaps by adding a global array of the same name, you can add a new box to the controls menu. Still not sure what those array strings are pointing at (e.g. CONTROL_ACTION).

CONTROL_ACTION, etc are just variables that hold numbers and are all defined in constants.lua.

From looking at this briefly, it doesn't look like it'll be an easy thing to do. Klei just loves making local tables that would be otherwise useful to modders. :(

Edited by squeek

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...