Skip to main content
Reads keys and mouse buttons, sends input to the game, and exposes view angles and movement.
Keys are Win32 virtual-key codes (0x41 is A). Mouse buttons use DOM numbering: 0 left, 1 middle, 2 right, 3 back, 4 forward.

Overview

Reading

isKeyDown, isMouseDown.

Injection

keyDown, keyPress, mouseClick, moveMouse, moveToAngle.

State

viewAngles, movement, mouse delta.

Reading

Reading always works, focused or not.

isKeyDown


Whether a key is held right now. Mouse-button virtual keys (0x01, 0x02, …) work too.

isMouseDown


Whether a mouse button is held. Default 0 (left).
For presses as events, listen to keydown and mousedown on the global target instead of polling.

Injection

Input is only sent while the game window has focus, the menu is closed and no text input (chat, IME) is active. Every call returns true when the input was sent and false when it was refused.
A keyDown that was sent stays down until a keyUp gets through. If the user opens the menu in between, the keyUp returns false, so retry it on the next tick.

moveMouse


A raw relative mouse move, in whole counts.

moveToAngle


Moves the mouse by what it takes to turn the view to angle (degrees), using your sensitivity, m_yaw and m_pitch.

State

input.state is the game’s input as of the current tick. Every field is null while it can’t be read, e.g. while the game is loading.

Example

Hold the back mouse button to pull toward the nearest enemy head in a 5° cone.