Skip to content
M2O Scripting APIScripting reference
Global objectClient APIGenerated

Key

const Key: object

Defined in: client/api.d.ts:2500

Client-only, resource-owned physical key bindings exposed as the global Key.

bind(key, stateOrHandler, handler?): boolean

Binds a resource-owned handler that fires while the game has foreground input and no UI is capturing it.

string

Case-insensitive supported keyboard or mouse key name.

"down" | "up" | KeyHandler | "both"

Trigger state, or the handler itself to use the default down state.

KeyHandler

Handler required when an explicit trigger state is provided.

boolean

True after the binding is installed; invalid keys or states throw.

isDown(key): boolean

Queries live physical key state using the same foreground and UI-input gate as binding dispatch.

string

Case-insensitive supported key name.

boolean

False when the key is up, the game is backgrounded, UI owns input, or the key name is invalid.

unbind(key, state?, handler?): boolean

Removes matching bindings owned by the calling resource; omitting filters removes every binding for the key.

string

Case-insensitive supported key name.

"down" | "up" | "both"

Optional trigger-state filter.

KeyHandler

Optional exact handler filter.

boolean

True when at least one binding was removed.