Input APIs

Functions

iswindowactive

bool iswindowactive()

Returns true if the game window is in focus.

lockwindow

void lockwindow()

Focuses and locks the game window. While locked, focus changes and input by the user are not seen by the game. Input can still be sent with the input API.

unlockwindow

void unlockwindow()

Unlocks the game window.

iswindowlocked

bool iswindowlocked()

Returns true if the game window is locked.

keypress

void keypress(key: KeyCode)

Simulates a key press for the specified KeyCode.

void keypress(key: number)

Simulates a key press for the specified virtual key-code.

keyrelease

void keyrelease(key: KeyCode)

Simulates a key press for the specified KeyCode.

void keyrelease(key: number)

Simulates a key release for the specified virtual key-code.

keyclick

void keyclick(key: KeyCode)

Simulates an instant key press + release for the specified KeyCode.

mouse1press

void mouse1press(x: number, y: number)

Simulates a left mouse button press at the specified coordinates.

void mouse1press()

Simulates a left mouse button press at the current mouse position.

mouse1release

void mouse1release(x: number, y: number)

Simulates a left mouse button release at the specified coordinates.

void mouse1release()

Simulates a left mouse button release at the current mouse position.

mouse1click

void mouse1click()

Simulates a left mouse click at the current mouse position.

mouse2press

void mouse2press(x: number, y: number)

Simulates a right mouse button press at the specified coordinates.

void mouse2press()

Simulates a right mouse button press at the current mouse position.

mouse2release

void mouse2release(x: number, y: number)

Simulates a right mouse button release at the specified coordinates.

void mouse2release()

Simulates a right mouse button release at the current mouse position.

mouse2click

void mouse2click()

Simulates a right mouse click at the current mouse position.

mousescroll

void mousescroll(forward: bool, x: number, y: number)

Simulates a scroll forward or backward at the specified coordinates.

void mousescroll(forward: bool)

Simulates a scroll forward or backward at the current mouse position.

mousemoverel

void mousemoverel(x: number, y: number, internal?: bool)

Moves the mouse relative to its current position. If provided, internal specifies whether a mouse movement event is signalled internally or your physical mouse cursor is moved. If not provided, internal is implied to be true if the game window is locked OR not active and false if otherwise. A physical mouse movement cannot occur when the game window is not in focus.

mousemoveabs

void mousemoveabs(x: number, y: number, internal?: bool)

Moves the mouse to the specified coordinates. If provided, internal specifies whether a mouse movement event is signalled internally or your physical mouse cursor is moved. If not provided, internal is implied to be true if the game window is locked OR not active and false if otherwise. A physical mouse movement cannot occur when the game window is not in focus.

iskeydown

bool iskeydown(key: number)

Returns true if the specified virtual-key code is pressed and the game window is in focus and not locked.

iskeytoggled

bool iskeytoggled(key: number)

Returns true if the specified virtual-key code is toggled (e.g. caps lock) and the game window is in focus and not locked.

getmousestate

bool getmousestate()

Returns true if the internal UI cursor is enabled.

setmousestate

void setmousestate(new_state: bool)

Enables or disables the internal UI cursor.