# SAvatarAppearance

## Index

### Functions Index

| Function Name                                                           |
| ----------------------------------------------------------------------- |
| void [**LoadOutfit** ](#loadoutfit)(int outfitID)                       |
| void [**ResetOutfit** ](#resetoutfit)()                                 |
| void [**ResetOutfitToTemplate** ](#resetoutfittotemplate)(int outfitID) |
| float [**GetSlider** ](#getslider)(SAppearanceSlider slider)            |
| float [**GetHeight** ](#getheight)()                                    |
| SColor [**GetSkinTone** ](#getskintone)()                               |
| SColor [**GetEyeTone** ](#geteyetone)()                                 |

### Properties Index

| Property Name                                   |
| ----------------------------------------------- |
| long [**OutfitID** ](#outfitid)`get`            |
| SGameObject [**Skeleton** ](#skeleton)`get`     |
| bool [**Loaded** ](#loaded)`get`                |
| SGameObject [**GameObject** ](#gameobject)`get` |

## Functions

### LoadOutfit

void **LoadOutfit** (int outfitID)

*Changes the current Avatar's outfit to outfitID. For a player Avatar, this only works on white-label grid. For NPC avatars, this works on all grids.*

| Parameter | Type | Description |
| --------- | ---- | ----------- |
|           |      |             |

{% tabs %}
{% tab title="Lua" %}

```lua
Space.Host.ExecutingObject.AvatarAppearance.LoadOutfit(160)
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Lua" %}

```lua
--this script toggles between 3 different outfits when NPC Statue object is clicked
--[Object needs to have an NPC Statue component]

outfits = {4134388, 4134385, 4134386}
currentOutfit = 0
thisObject = Space.Host.ExecutingObject


function OnClickFunction()
  if currentOutfit == #outfits then
  currentOutfit = 1
  else
  currentOutfit = currentOutfit + 1
  end

thisObject.AvatarAppearance.LoadOutfit(outfits[currentOutfit])
end


thisObject.AddClickable()
thisObject.Clickable.OnClick(OnClickFunction)
```

{% endtab %}
{% endtabs %}

### ResetOutfit

void **ResetOutfit** ()

*Changes the current Avatar's outfit and resets it to outfitID 0. For a player Avatar, this only works on white-label grid. For NPC avatars, this works on all grids.*

{% tabs %}
{% tab title="Lua" %}

```lua
Space.Host.ExecutingObject.AvatarAppearance.ResetOutfit()
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Lua" %}

```lua
--this script makes a UIButton reset an NPC statue outfit when clicked
--[UIButton object needs to be linked in scripting runtime references with name "button1"]
--[Object needs to have an NPC Statue component]

thisObject = Space.Host.ExecutingObject
refButton = Space.Host.GetReference("button1")

function OnClickFunction()
thisObject.AvatarAppearance.ResetOutfit()
end


refButton.UIButton.OnClick(OnClickFunction)
```

{% endtab %}
{% endtabs %}

### ResetOutfitToTemplate

void **ResetOutfitToTemplate** (int outfitID)

*Changes the current Avatar's outfit to outfitID only if the player running this code already owns that outfit. For a player Avatar, this only works on white-label grid. For NPC avatars, this works on all grids.*

| Parameter | Type | Description |
| --------- | ---- | ----------- |
|           |      |             |

{% tabs %}
{% tab title="Lua" %}

```lua
Space.Host.ExecutingObject.AvatarAppearance.ResetOutfitToTemplate(10001)
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Lua" %}

```lua
--this script toggles between 3 different outfits when NPC Statue object is clicked
--[Object needs to have an NPC Statue component]
--For this function, the player needs to own this outfit. Use LoadOutfit if player might not own it

outfits = {4134388, 4134385, 4134386}
currentOutfit = 0
thisObject = Space.Host.ExecutingObject


function OnClickFunction()
  if currentOutfit == #outfits then
  currentOutfit = 1
  else
  currentOutfit = currentOutfit + 1
  end

thisObject.AvatarAppearance.ResetOutfitToTemplate(outfits[currentOutfit])
end


thisObject.AddClickable()
thisObject.Clickable.OnClick(OnClickFunction)
```

{% endtab %}
{% endtabs %}

### GetSlider

float **GetSlider** (int slider)

*Return the value of Appearance Sliders.*

<table><thead><tr><th width="129">Parameter</th><th width="78.33333333333331">Type</th><th width="571.6666666666667">Description</th></tr></thead><tbody><tr><td>slider</td><td>int</td><td>1= Asian, 2= European, 3= African, 4= FaceShape, 5= FaceWidth, 6= FaceLength, 7= ForeheadShape, 8= ForeheadDepth, 9= CheekHeight, 10= CheekWidth, 11= JawShape, 12= JawWidth, 13= JawHeight, 14= EyebrowHeight, 15= EyebrowDepth, 16= EyeHeight, 17= EyeSpacing, 18= EyeSize, 19= EyeWidth, 20= EyeballSize, 21= EyeInside, 22= EyeOutside, 23= EyelashLength, 24= NoseWidth, 25= NoseDepth, 26= NoseHeight, 27= NoseShape, 28= NoseTipShape, 29= NostrilWidth, 30= MouthWidth, 31= MouthHeight, 32= MouthDepth, 33= UpperLipWidth, 34= UpperLipThickness, 35= LowerLipWidth, 36= LowerLipThickness, 37= Smile, 38= EarHeight, 39= EarWidth, 40= Earlobe, 41= EarShape, 42= Muscular, 43= Toned, 44= Grand, 45= Lean, 46= SkullHeight, 47= SkullWidth, 48= SkullDepth, 49= NeckThickness, 50= ShoulderThickness, 51= UpperArmThickness, 52= ForearmThickness, 53= WristSize, 54= ElbowThin, 55= HandThickness, 56= HandTone, 57= FingerWidth, 58= BustProximity, 59= BustSize, 60= ChestDepth, 61= PectoralSize, 62= PectoralHeight, 63= AbdomenMiddle, 64= AbdomenDepth, 65= WaistWidth, 66= HipSize, 67= GlutesSize, 68= GlutesHeight, 69= LoveHandles, 70= ThighSize, 71= KneeTone, 72= ShinSize, 73= AnkleTone, 74= FootThickness, 75= FootTone, 76= ToeWidth, 77= HeadSize, 78= NeckSize, 79= ShoulderSize, 80= UpperArmSize, 81= ForearmSize, 82= HandSize, 83= SpineSize, 84= ChestSize, 85= UpperLegSize, 86= LowerLegSize, 87= FeetSize, 88= ToesSize, 89= HeadPosition, 90= NeckLength, 91= ForearmLength, 92= HandPosition, 93= SpineLength, 94= ChestLength, 95= UpperLegLength, 96= LowerLegLength, 97= FeetLength, 98= ToesLength, 99= ShoulderHeight, 100= ShoulderWidth, 101= FeetFloorOffset</td></tr></tbody></table>

{% tabs %}
{% tab title="Lua" %}

```lua
FaceLength = Space.Host.ExecutingObject.AvatarAppearance.GetSlider(AppearanceSlider.FaceLength)
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Lua" %}

```lua
--this script updates a UIText with the current Face Length of the npc

thisObject = Space.Host.ExecutingObject
uiText = Space.Host.GetReference("thetext").UIText --Add this object with UIText component as reference in Scripting Runtime

OnUpdateFunction = function()
uiText.Text = thisObject.AvatarAppearance.GetSlider(AppearanceSlider.FaceLength)
end


thisObject.OnUpdate(OnUpdateFunction)
```

{% endtab %}
{% endtabs %}

### GetHeight

float **GetHeight** ()

*Return height of avatar.*

{% tabs %}
{% tab title="Lua" %}

```lua
height = Space.Host.ExecutingObject.AvatarAppearance.GetHeight()
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Lua" %}

```lua
--this script updates a UIText with the height of this NPC statue

thisObject = Space.Host.ExecutingObject
uiText = Space.Host.GetReference("thetext").UIText --Add this object with UIText component as reference in Scripting Runtime

OnUpdateFunction = function()
uiText.Text = thisObject.AvatarAppearance.GetHeight()
end


thisObject.OnUpdate(OnUpdateFunction)
```

{% endtab %}
{% endtabs %}

### GetSkinTone

[SColor](https://docs.breakroom.tech/scripting/client-scripting-api-reference/types/scolor) **GetSkinTone** ()

*Return skin tone of avatar.*

{% tabs %}
{% tab title="Lua" %}

```lua
SkinTone = Space.Host.ExecutingObject.AvatarAppearance.GetSkinTone()
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Lua" %}

```lua
--this script updates a UIText with the current Skin Tone of the npc

thisObject = Space.Host.ExecutingObject
uiText = Space.Host.GetReference("thetext").UIText --Add this object with UIText component as reference in Scripting Runtime

OnUpdateFunction = function()
uiText.Text = thisObject.AvatarAppearance.GetSkinTone().ToString()
end


thisObject.OnUpdate(OnUpdateFunction)
```

{% endtab %}
{% endtabs %}

### GetEyeTone

[SColor](https://docs.breakroom.tech/scripting/client-scripting-api-reference/types/scolor) **GetEyeTone** ()

*Return eye tone of avatar.*

{% tabs %}
{% tab title="Lua" %}

```lua
 EyeTone = Space.Host.ExecutingObject.AvatarAppearance.GetEyeTone()
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Lua" %}

```lua
--this script updates a UIText with the current Eye Tone of the npc

thisObject = Space.Host.ExecutingObject
uiText = Space.Host.GetReference("thetext").UIText --Add this object with UIText component as reference in Scripting Runtime

OnUpdateFunction = function()
uiText.Text = thisObject.AvatarAppearance.GetEyeTone().ToString()
end


thisObject.OnUpdate(OnUpdateFunction)
```

{% endtab %}
{% endtabs %}

## Properties

### OutfitID

long **OutfitID** `get`

*Return the current outfit id.*

{% tabs %}
{% tab title="Lua" %}

```lua
outfitID= Space.Host.ExecutingObject.AvatarAppearance.OutfitID
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Lua" %}

```lua
--this script updates a UIText with the current outfit ID of the npc

thisObject = Space.Host.ExecutingObject
uiText = Space.Host.GetReference("thetext").UIText --Add this object with UIText component as reference in Scripting Runtime

OnUpdateFunction = function()
uiText.Text = thisObject.GameObject.AvatarAppearance.OutfitID
end


thisObject.OnUpdate(OnUpdateFunction)
```

{% endtab %}
{% endtabs %}

### Skeleton

[SGameObject](https://docs.breakroom.tech/scripting/client-scripting-api-reference/types/sgameobject) **Skeleton** `get`

*Return the GameObject of avatar skeleton.*

{% tabs %}
{% tab title="Lua" %}

```lua
playerSkeleton = Space.Host.ExecutingObject.AvatarAppearance.Skeleton
```

{% endtab %}
{% endtabs %}

### Loaded

bool **Loaded** `get`

*Returns true if the avatar is full loaded.*

{% tabs %}
{% tab title="Lua" %}

```lua
isLoaded= Space.Host.ExecutingObject.AvatarAppearance.Loaded
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Lua" %}

```lua
--this script updates a UIText with the loading status of the npc

thisObject = Space.Host.ExecutingObject
uiText = Space.Host.GetReference("thetext").UIText --Add this object with UIText component as reference in Scripting Runtime

OnUpdateFunction = function()
uiText.Text = thisObject.AvatarAppearance.Loaded
end


thisObject.OnUpdate(OnUpdateFunction)
```

{% endtab %}
{% endtabs %}

### GameObject

[SGameObject](https://docs.breakroom.tech/scripting/client-scripting-api-reference/types/sgameobject) **GameObject** `get`

*Property Description*

{% tabs %}
{% tab title="Lua" %}

```lua
 npcGameObject = Space.Host.ExecutingObject.AvatarAppearance.GameObject
```

{% endtab %}
{% endtabs %}
