Ability to read CapsLock & NumLock states

Requesting that a way to read the current state of CapsLock and NumLock be added to the engine API.
Note that this is different from the keypress state:
I’m requesting to be able to read the toggled-state (associated LED-on or LED-off.)

  • This would be useful for in-game feature toggles.
  • Devs would choose to use CapsLock / NumLock for toggles as they could be in sync with LEDs.
  • Would allow a gentle reminder to player entering chat that CapsLock is on (discouraging “shouting.”)
  • Could free up other devs’ key bindings that are used for toggles that may conflict with de facto bindings.
  • Desktop app already nullifies in-game keypad NumLock changes (other than chat) (Not [yet] for UWP.)

A possible implementation suggestion:

If it’s too much to ask for a solution such as adding UserInputService:GetLockKeysState(),
I’d be happy with a solution that needs no additional API calls such as:
Having the UserInputService.InputBegan event’s callback [and UserInputService.InputChanged?]
called with the InputObject.position.Z reflect the toggled mode state of the keylock ala how the
mouse wheel change is currently done, such as:

  • Z: KeyLock (1), KeyUnlock (-1), Unknown (0)
14 Likes