Jump to content

An odd question about key bindings


pickleplayer

Recommended Posts

So, um.

Say I wanted to completely remove the W and S keys functionality of walking the player north or south...

How would I go about doing that? (I don't need to remove the ability to walk north with the mouse, I just want to use the W key for something else)

 

I've been looking through all the controls lua files. Mostly playercontroller.lua. But I can't seem to find where they define it.

 

 

 

Also, while we're on the topic, is there a list of key control names anywhere? It's easy to define letter keys like KEY_R, but what about the numpad keys? I found a list of defined keys somewhere in the game's files, but the game doesn't seem to actually recognize them? It said the numpad 2 key was KEY_KP2, but it just crashes when I try to use it (the regular KEY_2 works fine, but I want the numpad 2 key)

Link to comment
Share on other sites

You won't find W or S keys there because that's determined (and can be changed) by the player's settings. Look for CONTROL_MOVE_UP and CONTROL_MOVE_DOWN instead.

 

It said the numpad 2 key was KEY_KP2, but it just crashes when I try to use it
 

What was the error message when it crashed? Maybe you didn't use the GLOBAL table or something.

Link to comment
Share on other sites

You won't find W or S keys there because that's determined (and can be changed) by the player's settings. Look for CONTROL_MOVE_UP and CONTROL_MOVE_DOWN instead.

 

 

 

 

What was the error message when it crashed? Maybe you didn't use the GLOBAL table or something.

 

Ah, thanks! I Was able to find it pretty quick and comment them out and now it works!

 

 

And the error says the key isn't defined. 

After doing a TON of digging, I realized that all the keys are actually re-defined in constants.lua, which is what the game pulls from (I guess.) all the key numbers are the same as the ones in strings.lua, but they just flat out don't re-define some of the numpad keys so the key that was defined as KEY_KP2 in strings doesn't show up. I even tried using the key's number value from strings

"if GLOBAL.TheInput:IsKeyDown(258) then"

But that doesn't work either

 

wait- ...

Okay, so after typing up all of this I just realized I had numlock turned on. Welp.

Okay so now using "258" as the key value works. (the other methods still don't though)

 

So I guess that solves my problem. Thanks! 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...