Creator
constCreator:object
Defined in: client/api.d.ts:2712
Live edits to the local player’s look, for a resource’s own character-creator UI.
Type Declaration
Section titled “Type Declaration”applyPatch()
Section titled “applyPatch()”applyPatch(
patch):number
Queues one apply per entry and returns how many were queued. An entry that is malformed on its face is refused, logged and NOT counted: an unknown category, a bad “#rrggbb”, a color or an empty string where the category takes none. A well-formed id the game does not know is still queued and dropped on the game thread: each queued entry raises its own creatorChanged, whose change.ok says whether it applied. An EMPTY string clears the category, which only glasses, facialHair and facialHairColor support. hairColour, browColour and eyeColour also take a “#rrggbb” color, and browColour “hair” to follow the hair; a later preset of that category or a full-body preset replaces it. preset is applied FIRST because it can switch gender. Throws without an active session.
Parameters
Section titled “Parameters”Record<string, string>
category -> option id, e.g. { hairStyle: “DA_HairMale012” }.
Returns
Section titled “Returns”number
begin()
Section titled “begin()”begin(
options?):boolean
Claims the editing session and snapshots the appearance, so cancel() can restore it. Returns false if another resource already holds it — check before showing your UI.
Parameters
Section titled “Parameters”options?
Section titled “options?”Reserved; a session always starts from the current look today.
preserveCurrent?
Section titled “preserveCurrent?”boolean
Returns
Section titled “Returns”boolean
cancel()
Section titled “cancel()”cancel():
boolean
Discards the edits and restores the snapshot taken by begin(). False if you don’t hold the session.
Returns
Section titled “Returns”boolean
commit()
Section titled “commit()”commit():
boolean
Keeps the edits: settles the look into its persistable form and releases the snapshot. False if you don’t hold the session. Queued patches are guaranteed to be applied BEFORE the settle – but this RETURNS IMMEDIATELY, it does not wait for the game to finish. Do not read the look off the back of it; wait for the server’s playerAppearanceChanged instead.
Returns
Section titled “Returns”boolean
exportLook()
Section titled “exportLook()”exportLook():
LookJson|null
The local player’s look as plain ids under the creator’s category names: what a person can read, edit, share and hand back to importLook or the server’s player.setLook. null when there is no live character. Never includes a transmog.
Returns
Section titled “Returns”LookJson | null
getCapabilities()
Section titled “getCapabilities()”getCapabilities():
CreatorCapabilities
What this build’s Creator API supports: version, whether a session is held and by whom, and a flag per feature. Branch on these rather than on the mod version.
Returns
Section titled “Returns”getSchema()
Section titled “getSchema()”getSchema():
CreatorSchema|null
Every category and the stable option ids it accepts. null until built (begin() primes it). GENDER-SCOPED: a full-body preset switches gender and re-resolves every category, so re-read after one.
Returns
Section titled “Returns”CreatorSchema | null
getState()
Section titled “getState()”getState():
CreatorState|null
The current selections, face gear, facial hair, voice and name. Refreshed after each applyPatch, so read it on creatorChanged rather than immediately after patching.
Returns
Section titled “Returns”CreatorState | null
importLook()
Section titled “importLook()”importLook(
look):boolean
Applies a look given as ids to the local player. Validated synchronously: false, with the reason logged, when a field is malformed (a gear id without GA_, an unknown category, a newer version). True means it was QUEUED; the apply runs on the game thread and an id the game does not know is dropped there. Watch creatorChanged for the result.
Parameters
Section titled “Parameters”string | LookJson
A look from exportLook, the server’s player.getLook or a stored copy, or its JSON text.
Returns
Section titled “Returns”boolean
isActive()
Section titled “isActive()”isActive():
boolean
Whether any resource holds a creator session.
Returns
Section titled “Returns”boolean
previewVoice()
Section titled “previewVoice()”previewVoice():
boolean
Plays the game creator’s voice sample line in the voice and pitch currently set, as its own creator does at every voice change. Queued after any setVoice before it, so call it right after one. Each call cuts off a sample still playing, so the newest voice is the one heard; it can start up to half a second late while the cut one fades out. Plays even under an Audio dialogue policy muting the player. Returns true once queued. Requires an active session.
Returns
Section titled “Returns”boolean
setName()
Section titled “setName()”setName(
first,last?):boolean
Sets the character name. Requires an active session.
Parameters
Section titled “Parameters”string
Given name.
string
Family name.
Returns
Section titled “Returns”boolean
setVoice()
Section titled “setVoice()”setVoice(
voice):boolean
Sets the voice. Not a preset category, so it cannot ride applyPatch. Returns whether anything was queued; read the result back on creatorChanged. Requires an active session.
Parameters
Section titled “Parameters”tone 0/1 = the creator’s VOICE ONE/TWO; pitch -2..+2, 0 = default.
pitch?
Section titled “pitch?”number
number
Returns
Section titled “Returns”boolean