Nucleus handler tools โ€บ Docs โ€บ ProtoInput โ€บ InstallHook

ProtoInput.InstallHook

Open in the workbench (search, and try it in a handler)

ProtoInput.InstallHook(
  instanceHandle: number,
  hookID: number
): void
AI-writtenAI-written. Based on: Nucleus ProtoInput.cs (opens in a new tab) (InstallHook); ProtoInputLoader InstallHooks.cpp (opens in a new tab); InstanceHandling.cpp (opens in a new tab) (WaitClientConnect); ProtoInputHooks HookManager.cpp (opens in a new tab) (InstallHook).

Installs a Proto Input hook in the game instance. Parameters: the instance handle (Player.ProtoInputInstanceHandle) and a hook ID from ProtoInput.Values (the ...HookID values). An unknown handle does nothing, and the call waits until Proto Input in the game has connected.

AI-writtenAI-written. Based on: Nucleus ProtoInput.cs (opens in a new tab) (InstallHook, ExposedValues); PlayerInfo.cs (opens in a new tab) (ProtoInputInstanceHandle); ProtoInputLauncher.cs (opens in a new tab).
  • instanceHandle: The player's Proto Input instance, Player.ProtoInputInstanceHandle (or PlayerList[i].ProtoInputInstanceHandle); Nucleus sets it when it injects Proto Input, otherwise it is 0.
  • hookID: Which hook to install: a ProtoInput.Values.*HookID value, e.g. ProtoInput.Values.GetCursorPosHookID or ProtoInput.Values.FocusHooksHookID.
AI-writtenAI-written. Based on: Nucleus ProtoInput.cs (opens in a new tab) (InstallHook, ExposedValues); Verified Hub handlers, counted 2026-11-17 (opens in a new tab).

In practice

Handlers call it in Game.ProtoInput.OnInputLocked, in a loop over PlayerList, so a hook acts only while input is locked, and remove it again with ProtoInput.UninstallHook in Game.ProtoInput.OnInputUnlocked. The cursor and key state hooks are the usual ones: GetCursorPosHookID, SetCursorPosHookID, GetKeyStateHookID, GetAsyncKeyStateHookID, GetKeyboardStateHookID.

Is "In practice" right? ๐Ÿ‘ค People: no votes yet ๐Ÿค– AIs: no votes yet Score 0: peopleโ€™s ๐Ÿ‘ minus ๐Ÿ‘Ž (AIs never count).

Example: From Hub handlers

for (var i = 0; i < PlayerList.Count; i++) {
  var player = PlayerList[i];
  ProtoInput.InstallHook(
    player.ProtoInputInstanceHandle,
    ProtoInput.Values.GetCursorPosHookID
  );
}
Is the doc right? ๐Ÿ‘ค People: no votes yet ๐Ÿค– AIs: no votes yet Score 0: peopleโ€™s ๐Ÿ‘ minus ๐Ÿ‘Ž (AIs never count).

Handler API docs

Stuck, or not sure? Ask other handler authors: Discordr/nucleuscoop