Jump to content

Recommended Posts

Im trying to add another mod's functionality to mine, but it uses a keyboard key for a special bind. Im trying to add an option to bind the special action to a gamepad button. Thus far, I have

ModInfo:

--config option for bind
name = "SneakKey",
label = "Sneak key?",
options = 
{description = "Gamepad", data = 1003, hover = "Activate with B Gamepad Button"},

Where data is sent into "stealthkey". 

ModMain:

--Toggle Sneak
G.TheInput:AddKeyDownHandler(stealthkey, function()
	if CZ() then
		SendModRPCToServer(MOD_RPC[modname]["MissySneaking"], true)
	end
end)
G.TheInput:AddKeyUpHandler(stealthkey, function()
	if CZ() then
		SendModRPCToServer(MOD_RPC[modname]["MissySneaking"], false)
	end
end)

I'm using a KeyCode that I found for another lua game. Using the list, I can successfully bind any key on a keyboard, but none of the gamepad buttons that are listed work. (1003 for B Button or 1009 for L3, for example) I have tried to use different terms in place of "AddKeyDown/UpHandler", but nothing I have come across has worked, even trying code from Dont Starve's input.lua and action.lua. I don't fully understand the original mod's inner workings, so if I need to clarify anything else about the rest of the code, please let me know.

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