wiki.sine.space | sinespace

Difference between revisions of "Scripting/SAvatarAppearance"

From wiki.sine.space
Jump to: navigation, search
Line 3: Line 3:
  
  
{{ScriptFunction|void|LoadOutfit|(int outfitID);|description||5=<pre></pre>|6=<pre></pre>}}
+
{{ScriptFunction|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.|5=<pre>Space.Host.ExecutingObject.AvatarAppearance.LoadOutfit(160)</pre>|6=<pre>--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
  
{{ScriptFunction|void|ResetOutfit|();|description||5=<pre></pre>|6=<pre></pre>}}
 
  
 +
function OnClickFunction()
 +
  if currentOutfit == #outfits then
 +
  currentOutfit = 1
 +
  else
 +
  currentOutfit = currentOutfit + 1
 +
  end
  
{{ScriptFunction|void|ResetOutfitToTemplate|(int outfitID);|description|5=<pre></pre>|6=<pre></pre>}}
+
thisObject.AvatarAppearance.LoadOutfit(outfits[currentOutfit])
 +
end
 +
 
 +
 
 +
thisObject.AddClickable()
 +
thisObject.Clickable.OnClick(OnClickFunction)</pre>}}
 +
 
 +
 
 +
{{ScriptFunction|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. |5=<pre>Space.Host.ExecutingObject.AvatarAppearance.ResetOutfit()</pre>|6=<pre>--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)</pre>}}
 +
 
 +
 
 +
{{ScriptFunction|void|ResetOutfitToTemplate|(int outfitID);|For a player Avatar, this only works on white-label grid. For NPC avatars, this works on all grids.|5=<pre></pre>|6=<pre></pre>}}
  
  

Revision as of 15:57, 17 January 2022

Public Member 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.

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


--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)


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.

Space.Host.ExecutingObject.AvatarAppearance.ResetOutfit()


--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)


ResetOutfitToTemplate

void ResetOutfitToTemplate (int outfitID);

For a player Avatar, this only works on white-label grid. For NPC avatars, this works on all grids.



GetSlider

float GetSlider (SAppearanceSlider slider);

Return the value of Appearance Sliders.



GetHeight

float GetHeight ();

Return height of avatar.



GetSkinTone

SColor GetSkinTone ();

Return skin tone of avatar.



GetEyeTone

SColor GetEyeTone ();

Return eye tone of avatar.



Properties

OutfitID

long OutfitID { get; }

Return the current outfit id.



Skeleton

SGameObject Skeleton { get; }

Return the GameObject of avatar skeleton.



Loaded

bool Loaded { get; }

Returns true if the avatar is full loaded.