Skip to content
KCKingdoms Connected Scripting APIScripting guides and API
Runtime classClient APIGenerated

NativeElement

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

A handle on one of the game’s own UI elements, driven where it stands.

new NativeElement(name, instanceId): NativeElement

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

Rebuilds a handle for an element; use NativeUI.element() to get one.

string

Element name, as its XML declares it.

number

Instance id.

NativeElement

call(fn, args?): any

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

Calls one of the element’s declared functions. The element has to be loaded: show it first, or call this on one the game already has up.

string

A function the element’s XML declares, by its display name or its ActionScript name.

(string | number | boolean | null)[]

Scalar arguments. They may also be passed loose, one per parameter.

any

What ActionScript returned, or null when the call failed.


getArray(name): any[] | null

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

Reads one of the element’s declared arrays.

string

An array the element’s XML declares.

any[] | null

Its contents, or null when it is absent.


getClip(name): { alpha: number; rotation: number; scaleX: number; scaleY: number; visible: boolean; x: number; y: number; } | null

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

Reads one of the element’s declared movie clips back. Scale and alpha come back as multipliers, the way setClip takes them.

string

A movie clip the element’s XML declares.

{ alpha: number; rotation: number; scaleX: number; scaleY: number; visible: boolean; x: number; y: number; } | null

Its display fields, or null when the clip is absent.


getVariable(name): any

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

Reads one of the element’s declared variables.

string

A variable the element’s XML declares.

any

The value, or null when it is absent.


gotoClip(name, frameOrLabel, play?): boolean

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

Moves a declared movie clip’s timeline, which is how a clip with several authored looks is switched between them.

string

A movie clip the element’s XML declares.

string | number

A one-based frame number, or a frame label.

boolean

Keep playing from there instead of stopping.

boolean

True when the frame or label resolved.


hide(): boolean

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

Hides the element at once.

boolean

True when the element took it.


off(event): void

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

Removes every handler this resource put on one event.

string

The event to stop listening for.

void


on(event, handler): void

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

Listens for one of the element’s declared events. This is how a click on a game screen reaches script.

string

An event the element’s XML declares, by its display name.

NativeElementHandler

Called on the next tick after the movie raises it.

void


reload(): boolean

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

Rebuilds the element’s movie from cached assets. Everything composed into it is gone afterwards.

boolean

True when the element took it.


requestHide(): boolean

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

Asks the element to play its own hide transition instead of vanishing.

boolean

True when the element took it.


setArray(name, values): boolean

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

Replaces one of the element’s declared arrays. This is how the game’s own list screens are filled.

string

An array the element’s XML declares.

(string | number | boolean | null)[]

The new contents.

boolean

True when the movie accepted it.


setClip(name, options): boolean

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

Moves one of the element’s declared movie clips. Two of the game’s elements declare any: the HUD and the lockpicking screen.

string

A movie clip the element’s XML declares.

Only the fields present are applied.

number

number

number

number

boolean

number

number

boolean

True when the movie accepted it.


setVariable(name, value): boolean

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

Assigns one of the element’s declared variables.

string

A variable the element’s XML declares.

string | number | boolean | null

What to assign.

boolean

True when the movie accepted it.


show(): boolean

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

Shows the element, loading its movie if it was not loaded.

boolean

True when the element took it.


toString(): string

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

Formats this handle for logging.

string


unload(): boolean

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

Drops the element’s movie. The next show loads it again.

boolean

True when the element took it.

readonly instanceId: number

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

Which instance this handle drives. Instance 0 is the one the game itself uses; any other number is a private copy of the same element.


readonly name: string

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

The element’s name, as its XML declares it.


readonly valid: boolean

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

Whether the element is still registered.


readonly visible: boolean

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

Whether the element is visible right now.