Skip to content

Scripting Input

Dreamy Cecil edited this page Oct 25, 2026 · 3 revisions

Important

Input polling is currently only possible during an active game, i.e. when you can control the player and not when the menu/console/NETRICSA is open.

Constants

  • Button enum - Contains constants for every KID_* value from the engine, e.g. Button.KID_A for "A" letter key or Button.KID_ENTER for Return/Enter key.
    • Button.KID_NONE
    • Button.KID_1
    • Button.KID_2
    • Button.KID_3
    • Button.KID_4
    • Button.KID_5
    • Button.KID_6
    • Button.KID_7
    • Button.KID_8
    • Button.KID_9
    • Button.KID_0
    • Button.KID_MINUS
    • Button.KID_EQUALS
    • Button.KID_Q
    • Button.KID_W
    • Button.KID_E
    • Button.KID_R
    • Button.KID_T
    • Button.KID_Y
    • Button.KID_U
    • Button.KID_I
    • Button.KID_O
    • Button.KID_P
    • Button.KID_LBRACKET
    • Button.KID_RBRACKET
    • Button.KID_BACKSLASH
    • Button.KID_A
    • Button.KID_S
    • Button.KID_D
    • Button.KID_F
    • Button.KID_G
    • Button.KID_H
    • Button.KID_J
    • Button.KID_K
    • Button.KID_L
    • Button.KID_SEMICOLON
    • Button.KID_APOSTROPHE
    • Button.KID_Z
    • Button.KID_X
    • Button.KID_C
    • Button.KID_V
    • Button.KID_B
    • Button.KID_N
    • Button.KID_M
    • Button.KID_COMMA
    • Button.KID_PERIOD
    • Button.KID_SLASH
    • Button.KID_F1
    • Button.KID_F2
    • Button.KID_F3
    • Button.KID_F4
    • Button.KID_F5
    • Button.KID_F6
    • Button.KID_F7
    • Button.KID_F8
    • Button.KID_F9
    • Button.KID_F10
    • Button.KID_F11
    • Button.KID_F12
    • Button.KID_ESCAPE
    • Button.KID_TILDE
    • Button.KID_BACKSPACE
    • Button.KID_TAB
    • Button.KID_CAPSLOCK
    • Button.KID_ENTER
    • Button.KID_SPACE
    • Button.KID_LSHIFT
    • Button.KID_RSHIFT
    • Button.KID_LCONTROL
    • Button.KID_RCONTROL
    • Button.KID_LALT
    • Button.KID_RALT
    • Button.KID_ARROWUP
    • Button.KID_ARROWDOWN
    • Button.KID_ARROWLEFT
    • Button.KID_ARROWRIGHT
    • Button.KID_INSERT
    • Button.KID_DELETE
    • Button.KID_HOME
    • Button.KID_END
    • Button.KID_PAGEUP
    • Button.KID_PAGEDOWN
    • Button.KID_PRINTSCR
    • Button.KID_SCROLLLOCK
    • Button.KID_PAUSE
    • Button.KID_NUM0
    • Button.KID_NUM1
    • Button.KID_NUM2
    • Button.KID_NUM3
    • Button.KID_NUM4
    • Button.KID_NUM5
    • Button.KID_NUM6
    • Button.KID_NUM7
    • Button.KID_NUM8
    • Button.KID_NUM9
    • Button.KID_NUMDECIMAL
    • Button.KID_NUMLOCK
    • Button.KID_NUMSLASH
    • Button.KID_NUMMULTIPLY
    • Button.KID_NUMMINUS
    • Button.KID_NUMPLUS
    • Button.KID_NUMENTER
    • Button.KID_MOUSE1
    • Button.KID_MOUSE2
    • Button.KID_MOUSE3
    • Button.KID_MOUSE4
    • Button.KID_MOUSE5
    • Button.KID_MOUSEWHEELUP
    • Button.KID_MOUSEWHEELDOWN
    • Button.KID_2MOUSE1
    • Button.KID_2MOUSE2
    • Button.KID_2MOUSE3
  • Axis enum - Contains indices and offsets of available input axes:
    • Axis.None - The first/unused axis
    • Axis.X1 - Horizontal mouse axis
    • Axis.Y1 - Vertical mouse axis
    • Axis.Z1 - Scroll wheel axis
    • Axis.X2 - Horizontal axis of the second mouse
    • Axis.Y2 - Vertical axis of the second mouse
    • Axis.Joysticks - Amount of available joysticks
    • Axis.PerJoystick - Amount of axes per joystick for offsetting
    • Axis.FirstJoystick - Index of the first axis of the first joystick for offsetting
    • Axis.Count - Total amount of available axes

Functions

Input.GetAxisCount()

Returns amount of available axes. Equivalent to the engine's CInput::GetAxisCount() function.

Return value: integer


Input.GetButtonsCount()

Returns amount of available buttons. Equivalent to the engine's CInput::GetButtonsCount() function.

Return value: integer


Input.GetAxisName(axis_index)

Returns internal name of the specified axis. Equivalent to the engine's CInput::GetAxisName() function.

Arguments:

  • axis_index - Index of an axis from the Axis enum.

Return value: string


Input.GetAxisTransName(axis_index)

Returns localized name of the specified axis. Equivalent to the engine's CInput::GetAxisTransName() function.

Arguments:

  • axis_index - Index of an axis from the Axis enum.

Return value: string


Input.GetAxisValue(axis_index)

Returns current value of the specified axis. For joystick axes, this value is always in the -1.0 .. +1.0 range. Equivalent to the engine's CInput::GetAxisValue() function.

Arguments:

  • axis_index - Index of an axis from the Axis enum.

Return value: float


Input.GetButtonName(button_index)

Returns internal name of the specified button. Equivalent to the engine's CInput::GetButtonName() function.

Arguments:

  • button_index - Index of a button from the Button enum.

Return value: string


Input.GetButtonTransName(button_index)

Returns localized name of the specified button. Equivalent to the engine's CInput::GetButtonTransName() function.

Arguments:

  • button_index - Index of a button from the Button enum.

Return value: string


Input.GetButtonState(button_index)

Checks whether the specified button is currently held down. Equivalent to the engine's CInput::GetButtonState() function.

Arguments:

  • button_index - Index of a button from the Button enum.

Return value: bool


Input.GetAxisByName(axis_name)

Returns axis index by its internal name, otherwise Axis.None.

Arguments:

  • axis_index - Internal name of the axis (the kind returned by Input.GetAxisName()).

Return value: integer with the index of the associated axis.


Input.GetButtonByName(button_name)

Returns button index by its internal name, otherwise Button.KID_NONE.

Arguments:

  • button_name - Internal name of the button (the kind returned by Input.GetButtonName()).

Return value: integer with the index of the associated button.

Clone this wiki locally