OPX//77
opx_infinityappearance

Client

Last updated on

The appearance contract on the client — faces, the mirror, the panel, the fitting room and clothing previews.

local appearance = OPX.Api.Get('appearance')

From client code inside opx_infinity. Every function answers a Result and never raises. A write answers that it was queued; the outcome arrives on opx:on:appearance:decision. Every function except State, ClosePanel, CloseWardrobe, OfferWardrobeGroups and EndClothingPreview answers appearance_unavailable when the client has no native appearance API.

GetSkin

The stored face as the server holds it.

appearance.GetSkin()

Returns

  • Result — { citizenId, family, snapshot }; error no_character

CaptureSkin

What the puppet wears now.

appearance.CaptureSkin()

Returns

  • Result — { snapshot, citizenId }; error: the capture failure, e.g. capture_failed

GetFamily

appearance.GetFamily()

Returns

  • Result — { family: 'female' | 'male', citizenId }

SetSkin

Puts a face on the puppet; stores nothing. Raises applied.

appearance.SetSkin(snapshot)

Parameters

  • snapshot: table

Returns

  • Result — { queued = true, citizenId }; errors no_character, appearance_busy, stored_build_mismatch, snapshot validation codes

SaveSkin

Sends a face to the server. Raises saved.

appearance.SaveSkin(snapshot)

Parameters

  • snapshot?: table — nil sends a capture

Returns

  • Result — { queued = true, citizenId }; errors no_character, appearance_busy, stored_build_mismatch

OpenEditor

Opens the game's mirror.

appearance.OpenEditor(mode)

Parameters

  • mode?: 'ripperdoc' | 'hairdresser' — default 'ripperdoc'

Returns

  • Result — { queued = true, citizenId }; errors invalid_mode, player_down, character_creation_in_progress, appearance_busy, no_character

OpenCreator

Answers needsCreation: opens the creation editor on the character's body.

appearance.OpenCreator()

Returns

  • Result — { queued = true, citizenId }; errors player_down, no_character, appearance_busy, creation_refused, already_has_a_face

IsOpen

appearance.IsOpen()

Returns

  • Result — { open, editing, creating, panel, wardrobe }; open = a native modal is on screen

IsSettled

While settled is false the player is not in the world.

appearance.IsSettled()

Returns

  • Result — { settled, announced, waiting, citizenId }; waiting is creator, creation, server, body, restore or nil

State

Diagnostic snapshot.

appearance.State()

Returns

  • Result — table: face state, body, panel, wardrobe, wardrobeOwed, wardrobePolicy, clothing (waiting, worn, previewing, saving, unsaved…), available

OpenPanel

Opens the appearance panel for a named caller; the same owner again redraws it.

appearance.OpenPanel(owner)

Parameters

  • owner: string

Returns

  • Result — { queued = true, citizenId }; errors invalid_caller, player_down, no_character, appearance_busy, panel_busy

ClosePanel

appearance.ClosePanel(owner)

Parameters

  • owner: string

Returns

  • Result — true; errors no_panel_open, not_owner

OpenWardrobe

Opens the fitting room for a named caller, on a thread. Does not grant a server save (see AllowClothingSave). A later failure raises wardrobeOpened with ok = false.

appearance.OpenWardrobe(owner)

Parameters

  • owner: string

Returns

  • Result — { queued = true, citizenId }; errors invalid_caller, wardrobe_busy, equipment_api_unavailable, player_down, player_unavailable (not alive on foot, or in a vehicle), spawn_up, input_captured

CloseWardrobe

Closes the room and puts back what the puppet wore.

appearance.CloseWardrobe(owner)

Parameters

  • owner: string

Returns

  • Result — true; errors no_wardrobe_open, not_owner

OfferWardrobeGroups

Adds a strip of buttons to the open room. A press raises wardrobeGroup. The strip goes when the room closes.

appearance.OfferWardrobeGroups(owner, groups)

Parameters

  • owner: string
  • groups: table[] — { id, label, disabled }; an empty list removes the caller's strip

Returns

  • Result — true; errors no_wardrobe_open, invalid_caller, invalid_groups
Example
appearance.OfferWardrobeGroups('shops', { { id = 'buy', label = 'Buy' } })

PriceWardrobe

Prices the open room: the room's status line shows what fn answers, e.g. On Save: 1,050 €$. Display only; the server bills from its own tables. The pricer goes when the room closes.

appearance.PriceWardrobe(owner, fn)

Parameters

  • owner: string
  • fn?: function(slots, draft) — answers the sentence, or nil for none; nil instead of a function takes the caller's price down

Returns

  • Result — true; errors no_wardrobe_open, invalid_caller, invalid_pricer
Example
appearance.PriceWardrobe('shops', function(slots)
  return #slots > 0 and ('On Save: %d €$'):format(50 * #slots) or nil
end)

DressWardrobe

Puts a look on the open room's draft. Slots this body's catalogue lacks are skipped.

appearance.DressWardrobe(records)

Parameters

  • records: table — slot → record name, or false

Returns

  • Result — true; errors no_wardrobe_open, wardrobe_closed, invalid_look, nothing_wearable

BeginClothingPreview

Borrows the puppet: nothing is saved or shown to others while it is lent. Refused while the fitting room holds it.

appearance.BeginClothingPreview(owner)

Parameters

  • owner: string

Returns

  • Result — { clothing, family, citizenId }; errors player_down, invalid_caller, preview_busy, no_character, clothing_unavailable, clothing_not_saved, clothing_not_ready, clothing_saving

EndClothingPreview

Gives the puppet back.

appearance.EndClothingPreview(owner, keep, records)

Parameters

  • owner: string
  • keep?: boolean — true saves what it wears; otherwise the stored record goes back on
  • records?: string[] — record names put on

Returns

  • Result — true; errors no_preview, not_owner

On this page