Brodysi Posted May 2, 2014 Share Posted May 2, 2014 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? Link to comment https://forums.kleientertainment.com/forums/topic/35822-how-to-add-a-control-to-the-controls-screen/ Share on other sites More sharing options...
wlayton27 Posted May 3, 2014 Share Posted May 3, 2014 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). Link to comment https://forums.kleientertainment.com/forums/topic/35822-how-to-add-a-control-to-the-controls-screen/#findComment-469862 Share on other sites More sharing options...
squeek Posted May 3, 2014 Share Posted May 3, 2014 (edited) 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 May 3, 2014 by squeek Link to comment https://forums.kleientertainment.com/forums/topic/35822-how-to-add-a-control-to-the-controls-screen/#findComment-469876 Share on other sites More sharing options...
Brodysi Posted May 5, 2014 Author Share Posted May 5, 2014 Thanks for the replies. I'm also pretty new to lua and I'm hating how you don't have to name the variable types in the code like with Python. I'll keep trying and post here again if I make any significant progress. Link to comment https://forums.kleientertainment.com/forums/topic/35822-how-to-add-a-control-to-the-controls-screen/#findComment-470724 Share on other sites More sharing options...
JackSlender Posted May 5, 2014 Share Posted May 5, 2014 I've managed to add a function for the SHIFT key (sprint). It works differently then you would think, though. I don't quite know how to add the handler, as I do mine from a component. Link to comment https://forums.kleientertainment.com/forums/topic/35822-how-to-add-a-control-to-the-controls-screen/#findComment-471360 Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now