Skip to content
KCKingdoms Connected Scripting APIScripting guides and API
Global objectClient APIGenerated

Inventory

const Inventory: object

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

Client-side overrides for actions in the local player’s native inventory. Register by catalog item name, class GUID, custom item id, or { uid } for one native instance. A matching handler replaces the action before native consumption or effects. Scripts run on the next feature update, outside the native detour; return values are ignored and errors do not restore the native action. Only owned, synchronized inventory items dispatch. Pending uses are discarded if their handler, native item, server row or inventory revision disappears or changes. Instance handlers take priority over class handlers; otherwise the newest matching registration wins. Removing it reveals the earlier handler. Resource stop and session end remove handlers. The server remains responsible for validating requests, consuming inventory and applying effects. This API does not intercept quick-slot actions outside the inventory.

offUse(handlerId): boolean

Removes a handler owned by the calling resource and discards its pending uses.

number

Id returned by onUse.

boolean

False if the registration is missing or belongs to another resource.

onUse(item, handler): number

Registers an inventory action override for this resource. Adds a Use action even for an item without a normal primary action. Duplicate presses on the same UID within one frame are combined.

string | { uid: string; }

Catalog name such as apple, a class GUID, a custom item id, or a native UID from InventoryUse.uid.

(use) => void

Runs instead of the native action. No item is automatically consumed.

number

A registration id for offUse. Throws for an unknown class, invalid UID, missing resource or more than 256 active registrations.