wiki.sine.space | sinespace

Difference between revisions of "Scripting/SGrid"

From wiki.sine.space
Jump to: navigation, search
Line 31: Line 31:
 
{{ScriptFunction|bool|IsWhiteLabel|{ get;}|Returns true if this Grid is a white-label Grid. |5=<pre>isWhiteLabel = Space.Grid.IsWhiteLabel</pre>|6=<pre></pre>}}
 
{{ScriptFunction|bool|IsWhiteLabel|{ get;}|Returns true if this Grid is a white-label Grid. |5=<pre>isWhiteLabel = Space.Grid.IsWhiteLabel</pre>|6=<pre></pre>}}
  
{{ScriptFunction|bool|PlayerIsAdmin|{ get;}|Returns true if this player's Grid role is Admin.(white-label grid only)|5=<pre>isAdmin = Space.Grid.PlayerIsAdmin</pre>|6=<pre></pre>}}
+
{{ScriptFunction|bool|PlayerIsAdmin|{ get;}|Returns true if this player's Grid role is Admin.(white-label grid only)|5=<pre>isAdmin = Space.Grid.PlayerIsAdmin</pre>|6=<pre>--Clicking this object will turn it green color if your grid role is Admin
 +
--and will turn it red color if not
  
{{ScriptFunction|bool|PlayerIsModerator|{ get;}|Returns true if this player's Grid role is Moderator. (white-label grid only) |5=<pre>isModerator = Space.Grid.PlayerIsModerator</pre>|6=<pre></pre>}}
+
thisObject = Space.Host.ExecutingObject
  
{{ScriptFunction|bool|PlayerIsDeveloper|{ get;}|Returns true if this player's Grid role is Developer.(white-label grid only)|5=<pre>isDeveloper = Space.Grid.PlayerIsDeveloper</pre>|6=<pre></pre>}}
+
function OnClickFunction()
  
{{ScriptFunction|bool|PlayerIsTrusted|{ get;}|Returns true if this player's Grid role is Trusted.(white-label grid only)|5=<pre>isTrusted = Space.Grid.PlayerIsTrusted</pre>|6=<pre></pre>}}
+
  if Space.Grid.PlayerIsAdmin then
 +
    thisObject.Renderer.Material.SetColor("_Color",Color.Green)
 +
  else
 +
    thisObject.Renderer.Material.SetColor("_Color",Color.Red)
 +
  end
 +
end
 +
 
 +
 
 +
thisObject.AddClickable()
 +
thisObject.Clickable.OnClick(OnClickFunction)</pre>}}
 +
 
 +
{{ScriptFunction|bool|PlayerIsModerator|{ get;}|Returns true if this player's Grid role is Moderator. (white-label grid only) |5=<pre>isModerator = Space.Grid.PlayerIsModerator</pre>|6=<pre>--Clicking this object will turn it green color if your grid role is Moderator
 +
--and will turn it red color if not
 +
 
 +
thisObject = Space.Host.ExecutingObject
 +
 
 +
function OnClickFunction()
 +
 
 +
  if Space.Grid.PlayerIsModerator then
 +
    thisObject.Renderer.Material.SetColor("_Color",Color.Green)
 +
  else
 +
    thisObject.Renderer.Material.SetColor("_Color",Color.Red)
 +
  end
 +
end
 +
 
 +
 
 +
thisObject.AddClickable()
 +
thisObject.Clickable.OnClick(OnClickFunction)</pre>}}
 +
 
 +
{{ScriptFunction|bool|PlayerIsDeveloper|{ get;}|Returns true if this player's Grid role is Developer.(white-label grid only)|5=<pre>isDeveloper = Space.Grid.PlayerIsDeveloper</pre>|6=<pre>--Clicking this object will turn it green color if your grid role is Developer
 +
--and will turn it red color if not
 +
 
 +
thisObject = Space.Host.ExecutingObject
 +
 
 +
function OnClickFunction()
 +
 
 +
  if Space.Grid.PlayerIsDeveloper then
 +
    thisObject.Renderer.Material.SetColor("_Color",Color.Green)
 +
  else
 +
    thisObject.Renderer.Material.SetColor("_Color",Color.Red)
 +
  end
 +
end
 +
 
 +
 
 +
thisObject.AddClickable()
 +
thisObject.Clickable.OnClick(OnClickFunction)
 +
</pre>}}
 +
 
 +
{{ScriptFunction|bool|PlayerIsTrusted|{ get;}|Returns true if this player's Grid role is Trusted.(white-label grid only)|5=<pre>isTrusted = Space.Grid.PlayerIsTrusted</pre>|6=<pre>--Clicking this object will turn it green color if your grid role is Trusted
 +
--and will turn it red color if not
 +
 
 +
thisObject = Space.Host.ExecutingObject
 +
 
 +
function OnClickFunction()
 +
 
 +
  if Space.Grid.PlayerIsTrusted then
 +
    thisObject.Renderer.Material.SetColor("_Color",Color.Green)
 +
  else
 +
    thisObject.Renderer.Material.SetColor("_Color",Color.Red)
 +
  end
 +
end
 +
 
 +
 
 +
thisObject.AddClickable()
 +
thisObject.Clickable.OnClick(OnClickFunction)</pre>}}
  
 
{{ScriptFunction|string|Name|{ get;}|Returns the Grid's Name. (white-label grid only)|5=<pre>gridName = Space.Grid.Name</pre>|6=<pre></pre>}}
 
{{ScriptFunction|string|Name|{ get;}|Returns the Grid's Name. (white-label grid only)|5=<pre>gridName = Space.Grid.Name</pre>|6=<pre></pre>}}

Revision as of 20:44, 19 March 2022

Public Member Functions

GetEnabledUserRegions

void GetEnabledUserRegions (Closure onComplete);

Gets an SUserRegions object which contains data about the user's regions (the information in the "Region List" window).


GetRegionTexture

void GetRegionTexture (SPublicRegion region, Closure onComplete);

Returns the Region Texture (the image seen while loading the region) as a resource. This function requires an SPublicRegion object to identify which region. (white-label grids only)

Space.Grid.GetRegionTexture(AnSPublicRegionObject,OnCompleteFunction)


--When this object is clicked, it's material becomes the Region Texture of the user's first region

thisObject = Space.Host.ExecutingObject

function GetTextureComplete(textureResource)
  thisObject.Renderer.Material.SetTexture("_MainTex",textureResource)
end

function GetUserRegionsComplete(SUserRegions)
  r = SUserRegions.AvailableRegions
  Space.Grid.GetRegionTexture(r[1],GetTextureComplete)
end

Space.Grid.GetEnabledUserRegions(GetUserRegionsComplete)

GetRegionTexture

void GetRegionTexture (string json, Closure onComplete);

Returns the Region Texture (the image seen while loading the region) as a resource. This function requires a string to identify which region.


GetOutfits

void GetOutfits (Closure onComplete);

Gets the Grid's outfits as a table of SOutfit which contain Outfit data.



Public Attributes

OrientationRegion

int OrientationRegion {}

Returns the Region ID of the Orientation Region

 orientationRegion = Space.Grid.OrientationRegion


Properties

IsWhiteLabel

bool IsWhiteLabel { get;}

Returns true if this Grid is a white-label Grid.

isWhiteLabel = Space.Grid.IsWhiteLabel


PlayerIsAdmin

bool PlayerIsAdmin { get;}

Returns true if this player's Grid role is Admin.(white-label grid only)

isAdmin = Space.Grid.PlayerIsAdmin


--Clicking this object will turn it green color if your grid role is Admin
--and will turn it red color if not

thisObject = Space.Host.ExecutingObject

function OnClickFunction()

  if Space.Grid.PlayerIsAdmin then
    thisObject.Renderer.Material.SetColor("_Color",Color.Green)
  else
    thisObject.Renderer.Material.SetColor("_Color",Color.Red)
  end
end


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

PlayerIsModerator

bool PlayerIsModerator { get;}

Returns true if this player's Grid role is Moderator. (white-label grid only)

isModerator = Space.Grid.PlayerIsModerator


--Clicking this object will turn it green color if your grid role is Moderator
--and will turn it red color if not

thisObject = Space.Host.ExecutingObject

function OnClickFunction()

  if Space.Grid.PlayerIsModerator then
    thisObject.Renderer.Material.SetColor("_Color",Color.Green)
  else
    thisObject.Renderer.Material.SetColor("_Color",Color.Red)
  end
end


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

PlayerIsDeveloper

bool PlayerIsDeveloper { get;}

Returns true if this player's Grid role is Developer.(white-label grid only)

isDeveloper = Space.Grid.PlayerIsDeveloper


--Clicking this object will turn it green color if your grid role is Developer
--and will turn it red color if not

thisObject = Space.Host.ExecutingObject

function OnClickFunction()

  if Space.Grid.PlayerIsDeveloper then
    thisObject.Renderer.Material.SetColor("_Color",Color.Green)
  else
    thisObject.Renderer.Material.SetColor("_Color",Color.Red)
  end
end


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

PlayerIsTrusted

bool PlayerIsTrusted { get;}

Returns true if this player's Grid role is Trusted.(white-label grid only)

isTrusted = Space.Grid.PlayerIsTrusted


--Clicking this object will turn it green color if your grid role is Trusted
--and will turn it red color if not

thisObject = Space.Host.ExecutingObject

function OnClickFunction()

  if Space.Grid.PlayerIsTrusted then
    thisObject.Renderer.Material.SetColor("_Color",Color.Green)
  else
    thisObject.Renderer.Material.SetColor("_Color",Color.Red)
  end
end


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

Name

string Name { get;}

Returns the Grid's Name. (white-label grid only)

gridName = Space.Grid.Name


SiteURL

string SiteURL { get;}

Returns the Grid's Site URL. (white-label grid only)

siteUrl = Space.Grid.SiteURL


DefaultRegion

int DefaultRegion { get;}

Returns the Region ID of the Default Region. (white-label grid only)

defaultRegion = Space.Grid.DefaultRegion


Avatars

[[Scripting/int[]|int[]]] Avatars { get;}

Returns the IDs of all Avatars in the grid. (white-label grid only)

avatars = Space.Grid.Avatars