What keys are defined in Sandbox.InputButton?

Hello friends, I’m wondering what keys are available for a gamemode to bind to? I remember this topic came up previously and it was determined that consistent keyboard keys between gamemodes make for a better overall experience.
What’s the tentative keylist as it stands now?

I believe all keys are available, I don’t understand why would they limit them.

The previous discussion on limited keyboard keys was for consistency between gamemodes, which prevents player confusion and bad user experience in 99% of cases. A dev might think their K and P keys make sense when they’re a longterm user of their own gamemode, but an average new user might not know what to press.

Sandbox.InputButton defines some like InputButton.Reload, InputButton.Attack1, InputButton.Use, as shown in some example code that got posted. I’m curious what all of the defined ones are.

3 Likes

I like how gmod handled it, you were able to decide whether you want to use IN enums (IN_ATTACK etc) which the user binds or KEY enums which you can use to make your own, more advanced (?), input system.

1 Like

Yeah, I understand now, I like the gmod way too - but the two ways should be compatible (in gmod some functions/hooks used only IN enums)

Would be nice if you could make buttons like IN_ buttons for your gamemode without needing to write a wrapper for it yourself.

1 Like

would be nice to have like a modular keybind system, where you can use keybinds set by the user (like IN_ATTACK) or make your own keybind names that users can also set in the settings, for example you can name one BUY and bind it to B, then any gamemode that has an input named BUY will also use the same key the player set for the first one. Would allow players to customize their keybinds fully while still allowing developers to add as many inputs as they want

5 Likes

I just want to be able to bind callbacks or events to key presses/releases instead of checking for them every frame.

1 Like

Imo right now it’s done in the worst way possible.
For example, in hidden, this is how abilities are triggered:

But what if you don’t want the Third Person Toggle to be binded to V (because why tf would you want it to be there anyway)? Well it sucks you be you, because if you bind something else there - the UI still tells you to use V to activate an ability.

Here’s the list btw, might be a little outdated but probably not.

public enum InputButton : ulong {
        Attack1 = 1,
        Jump = 2,
        Duck = 4,
        Forward = 8,
        Back = 16,
        Use = 32,
        Cancel = 64,
        Left = 128,
        Right = 256,
        Attack2 = 512,
        Run = 1024,
        Reload = 2048,
        Alt1 = 4096,
        Alt2 = 8192,
        Walk = 16384,
        Weapon1 = 32768,
        Weapon2 = 65536,
        LookSpin = 131072,
        Zoom = 262144,
        Grenade1 = 524288,
        Grenade2 = 1048576,
        Score = 2097152,
        Drop = 4194304,
        View = 8388608,
        Menu = 16777216,
        Slot1 = 33554432,
        Slot2 = 67108864,
        Slot3 = 134217728,
        Slot4 = 268435456,
        Slot5 = 536870912,
        Slot6 = 1073741824,
        Slot7 = 2147483648,
        Slot8 = 4294967296,
        Slot9 = 8589934592,
        Slot0 = 17179869184,
        Next = 34359738368,
        Prev = 68719476736,
        Voice = 137438953472,
        Flashlight = 274877906944
    }

Oh I thought we could use something like event-based functions to handle inputs.
Is there an other method to handle inputs already implemented in the game? Could we implement something in C# to do it in a more proper way? Is there at least a more appropriate way to proceed?

This is obviously set up this way on purpose and I don’t think anything is stopping you from adding a window in your game that allows you to rebind your keys for that specific gamemode.

1 Like