All pages
Powered by GitBook
1 of 5

Loading...

Loading...

Loading...

Loading...

Loading...

Client

SShared

Index

Functions Index

Function Name

Functions

SetGlobal

void SetGlobal(string ns, string key, DynValue value)

Sets a global key to a value. The value can be any object type.

Parameter
Type
Description

SetSuperGlobal

void SetSuperGlobal(string ns, string key, DynValue value)

Function Description

Parameter
Type
Description

GetGlobal

DynValue GetGlobal(string ns, string key)

Retrieves a previously set global variable, or returns nil.

Parameter
Type
Description

GetSuperGlobal

DynValue GetSuperGlobal(string ns, string key)

Retrieves a previously set super global variable, or returns nil.

Parameter
Type
Description

RegisterFunction

void RegisterFunction(string ns, string func, Closure reference)

Makes func into a global function that can be accessed anywhere.

Parameter
Type
Description

RegisterBroadcastFunction

void RegisterBroadcastFunction(string ns, string func, Closure reference)

Makes func into a global function that can be accessed anywhere.

Parameter
Type
Description

UnregisterBroadcastFunction

void UnregisterBroadcastFunction(string ns, string func, Closure reference) void UnregisterBroadcastFunction(string ns, string func)

Function Description

Parameter
Type
Description

CallFunction

void CallFunction(string ns, string func, IEnumerable< DynValue > args)

Calls the registered function with the specified arguments.

Parameter
Type
Description

CallBroadcastFunction

void CallBroadcastFunction(string ns, string func, IEnumerable< DynValue > args)

Makes func into a global function that can be accessed anywhere.

Parameter
Type
Description

void SetGlobal(string ns, string key, DynValue value)

void SetSuperGlobal(string ns, string key, DynValue value)

DynValue GetGlobal(string ns, string key)

DynValue GetSuperGlobal(string ns, string key)

void RegisterFunction(string ns, string func, Closure reference)

void RegisterBroadcastFunction(string ns, string func, Closure reference)

void UnregisterBroadcastFunction(string ns, string func, Closure reference)

void UnregisterBroadcastFunction(string ns, string func)

void CallFunction(string ns, string func, IEnumerable< DynValue > args)

void CallBroadcastFunction(string ns, string func, IEnumerable< DynValue > args)

ns

string

key

string

value

DynValue

Space.Shared.SetGlobal("com.someNameHere.world", "version", "1.02");
-- This one script placed on a multiple number of objects  will track the number
-- of clicks user has made using a Global Variable
-- note: the GetGlobal/SetGlobal functions are client side

thisObject = Space.Host.ExecutingObject
namespace = "com.example.shared" 
key = "clicktracker"


OnClick = function()

local currentClicks = Space.Shared.GetGlobal(namespace, key)

if currentClicks == nil then
  currentClicks = 1
else
  currentClicks = currentClicks + 1
end

Space.Shared.SetGlobal(namespace, key, currentClicks)
Space.Log("Total Clicks = " .. currentClicks)

end
  

thisObject.AddClickable()
thisObject.Clickable.OnClick(OnClick)
Space.Shared.SetSuperGlobal("com.someNameHere.world", "version", "1.02");
example 2
versionValue = Space.Shared.GetGlobal("com.someNameHere.world", "version")
-- This one script placed on a multiple number of objects  will track the number
-- of clicks user has made using a Global Variable
-- note: the GetGlobal/SetGlobal functions are client side

thisObject = Space.Host.ExecutingObject
namespace = "com.example.shared" 
key = "clicktracker"


OnClick = function()

local currentClicks = Space.Shared.GetGlobal(namespace, key)

if currentClicks == nil then
  currentClicks = 1
else
  currentClicks = currentClicks + 1
end

Space.Shared.SetGlobal(namespace, key, currentClicks)
Space.Log("Total Clicks = " .. currentClicks)

end
  

thisObject.AddClickable()
thisObject.Clickable.OnClick(OnClick)
versionValue = Space.Shared.GetSuperGlobal("com.someNameHere.world", "version");
--these two scripts are in two different regions but script B will know that you came from A

--REGION A script
username = Space.Scene.PlayerAvatar.Username
region = Space.Scene.Name
Space.Shared.SetSuperGlobal (username, "Last Location", region)



--REGION B script
username = Space.Scene.PlayerAvatar.Username
region = Space.Shared.GetSuperGlobal (username, "Last Location")
Space.Dialogues.SendLocalChat ("You have arrived from ".. region, "Last Location")
function someFunction(name)
  Space.Log("Hello " .. name);
end

Space.Shared.RegisterFunction("com.someNameHere.world", "func", someFunction);
--Script placed on object A will allow other objects to call one of it's registered functions when clicked

--Script in Object A
thisObject = Space.Host.ExecutingObject
namespace = "com.example.shared" 

LogFunction = function(Parameter)
Space.Log("I've been called with parameter: " .. Parameter)  
end

Space.Shared.RegisterFunction(namespace, "Log", LogFunction)



-- Script in Other Objects
thisObject = Space.Host.ExecutingObject
namespace = "com.example.shared" 

OnClick = function()
Space.Shared.CallFunction(namespace, "Log", {"Example"}) 
end

thisObject.AddClickable()
thisObject.Clickable.OnClick(OnClick)
function someFunction(name)
  Space.Log("Hello " .. name);
end

Space.Shared.RegisterBroadcastFunction("com.someNameHere.world", "func", someFunction);
-- Script A: Receiver
function someFunction(status)
  if status == "start"
  then Space.Log("Do receiver 1 procedures.")
  end
end

Space.Shared.RegisterBroadcastFunction("com.someNameHere.world", "func", someFunction);


-- Script B: Another Receiver
function someFunction(status)
  if status == "start"
  then Space.Log("Do receiver 2 procedures.")
  end
end

Space.Shared.RegisterBroadcastFunction("com.someNameHere.world", "func", someFunction);


--Script C: Sender
local ball = Space.Host.ExecutingObject;
ball.SubscribeToEvents();

function onDown()
  local queue = Space.Shared.CallBroadcastFunction("com.someNameHere.world", "func", {"start"});
  Space.Log("number in queue: " .. queue);
  Space.Shared.UnregisterBroadcastFunction("com.someNameHere.world", "func", someFunction);
  Space.Log("UnregisterBroadcastFunction");
end


ball.OnMouseDown(onDown);
Space.Shared.CallFunction("com.someNameHere.world", "func",{"Smith"});
--Script placed on object A will allow other objects to call one of it's registered functions when clicked

--Script in Object A
thisObject = Space.Host.ExecutingObject
namespace = "com.example.shared" 

LogFunction = function(Parameter)
Space.Log("I've been called with parameter: " .. Parameter)  
end

Space.Shared.RegisterFunction(namespace, "Log", LogFunction)



-- Script in Other Objects
thisObject = Space.Host.ExecutingObject
namespace = "com.example.shared" 

OnClick = function()
Space.Shared.CallFunction(namespace, "Log", {"Example"}) 
end

thisObject.AddClickable()
thisObject.Clickable.OnClick(OnClick)
function someFunction(name)
  Space.Log("Hello " .. name);
end

Space.Shared.RegisterBroadcastFunction("com.someNameHere.world", "func", someFunction);

SDialogues

Index

Function Name

void (string title, string okbutton, Action< SColor > onChange, Action< SColor > onSelect, Action onCancel, SColor defaultColor)

void (string title, string okbutton, string cancelButton, Action< bool > result)

void (string title, string okButton, Action< string > result)

Functions

ColorPicker

Opens a color picker dialogue.

void ColorPicker(string title, string okbutton, Action< SColor > onChange, Action< SColor > onSelect, Action onCancel, SColor defaultColor)

Parameter
Type
Description

YesNoInput

Opens a simple Yes/No dialogue.

void YesNoInput(string title, string okbutton, string cancelButton, Action< bool > result)

Parameter
Type
Description

TextInput

Opens a text entry window with room for a single multi-line text field.

void TextInput ( string title, string okButton, Action< string > result)

Parameter
Type
Description

OpenURL

Opens the specified URL in the in-app web browser, or the system web browser. In some environments the user may be prompted before this is opened.

void OpenURL ( string url, bool newTab = true )

Parameter
Type
Description

SendLocalChat

Sends a message into the 'Script' chat channel.

void SendLocalChat ( string message, string from )

Parameter
Type
Description

SInput

Functions

GetKeyDown

bool GetKeyDown (string key)

Action<SColor> or Closure

Triggers onSelect(SColor) once the "ok" button is pressed.

onCancel

Action<SColor> or Closure

The title of the 'OK' button. Should indicate the action e.g. 'Adjust Wall'.

defaultColor

SColor

The color to open the colour picker with.

Action<bool>

Will fire a callback event depending on the status of the users actions

void OpenURL (string url, bool newTab = true)

void SendLocalChat (string message, string from)

title

string

The title of the color picker window. Choose something brief and appropriate like 'Select a wall color'.

okbutton

string

The title of the 'OK' button. Should indicate the action e.g. 'Adjust Wall'.

onChange

Action<SColor> or Closure

Any color change while the color picker is open will trigger onChange(SColor).

title

string

The question to be asked of the user. Should be a simple statement, e.g. "Save room changes?"

okbutton

string

The text on the OK button, should indicate the action, e.g. "Save Room"

cancelButton

string

The text on the cancel button, should indicate the action, e.g. "Not now"

title

string

The accompanying text. Should be something ala "Enter your username".

okButton

string

The text displayed on the OK button, should be descriptive, e.g. "Change Username".

result

Action< string >

Triggers result(string) once the "Ok" button is pressed.

url

string

The web address to open.

newTab

bool

Does the URL open in a new browser tab?

message

string

The message to appear in the channel.

from

string

The 'from' username for the message.

ColorPicker
YesNoInput
TextInput

onSelect

result

--clicking the object will open a color picker that changes the object's color
thisGameObject = Space.Host.ExecutingObject
originalColor = thisGameObject.Renderer.Material.GetColor("_Color")

OnChange = function(SColor) 
  thisGameObject.Renderer.Material.SetColor("_Color",SColor)
end

OnSelect = function(SColor)
  thisGameObject.Renderer.Material.SetColor("_Color",SColor)
end

OnCancel = function()
  thisGameObject.Renderer.Material.SetColor("_Color",originalColor)
end

OnClick = function()
  Space.Dialogues.ColorPicker("title","okbutton", OnChange, OnSelect, OnCancel, originalColor)
end


thisGameObject.AddClickable()
thisGameObject.Clickable.OnClick(OnClick)
hostObject = Space.Host.ExecutingObject
local deltaPos = Vector.New(0,100,0)
local teleportTo = hostObject.WorldPosition + deltaPos

function teleportMeUp (b)
  if b then
    Space.Scene.PlayerAvatar.Teleport(teleportTo)
  end
end

function openDialogue ()
  Space.Dialogues.YesNoInput ("Ready for a teleport?", "Yes", "No", teleportMeUp)
end

hostObject.SubscribeToEvents()
hostObject.OnMouseDown(openDialogue)
hostObject = Space.Host.ExecutingObject

printToLog = function (s)
  Space.Log(s)
end

function openDialogue ()
  Space.Dialogues.TextInput ("Write anything.", "Done", printToLog)
end

hostObject.OnMouseDown(openDialogue)
-- when the object is clicked, the "sine.space" website is opened
hostObject = Space.Host.ExecutingObject

function openTheWebsite ()
  Space.Dialogues.OpenURL("http://sine.space/")
end

hostObject.OnMouseDown(openTheWebsite)
hostObject = Space.Host.ExecutingObject

function chatMessage ()
  Space.Dialogues.SendLocalChat ("I've been clicked", "Clickable Object")
end

hostObject.OnMouseDown(chatMessage)
Returns true if 'key' was pressed during this frame.
Parameter
Type
Description

key

string

thisGameObject = Space.Host.ExecutingObject

OnUpdate = function()
  if Space.Input.GetKeyDown("space") then
 Space.Log("Jump Key Down")
  end
end

GetKeyUp

bool GetKeyUp (string key)

Returns true if 'key' is no longer pressed during this frame (but was in the last).

Parameter
Type
Description

key

string

GetKey

bool GetKey (string key)

Returns true if 'key' is being held pressed.

Parameter
Type
Description

key

bool

GetMouseDown

bool GetMouseDown (int button)

Returns true if mouse 'button' was pressed during this frame.

Parameter
Type
Description

button

int

button values are 0 for the primary button (often the left button), 1 for secondary button, and 2 for the middle button.

GetMouseUp

bool GetMouseUp (int button)

Returns true if mouse 'button' is no longer pressed during this frame (but was in the last).

Parameter
Type
Description

button

int

button values are 0 for the primary button (often the left button), 1 for secondary button, and 2 for the middle button.

GetMouseHold

bool GetMouseHold (int button)

Returns true if mouse 'button' is being held pressed.

Parameter
Type
Description

button

int

button values are 0 for the primary button (often the left button), 1 for secondary button, and 2 for the middle button.

Vibrate

void Vibrate (float intensity, float duration, bool leftHand)

Vibrates the controller (or phone, or gamepad) if a rumble device is present.

Parameter
Type
Description

intensity

float

Intensity of the vibration from 0.0 to 1.0

duration

float

Duration of the vibration. Maximum 1.0 second.

leftHand

bool

If true the vibration will be on the left hand and if false on the right hand (where applicable)

Properties

ScrollWheel

float ScrollWheel get

Returns a non-0 value if the mouse wheel is being scrolled, value usually ranges from -1 to 1**.**

MousePosition

SVector MousePosition get

Returns the current position of the mouse in screen pixels. If on a touch screen device, this will also return the location of the first finger being pressed.

MovementAxis

SVector MovementAxis get

Returns left/right (A/D) movement on X, forward/back (W/S) on Y, and up/down (E/C) on Z.

TurnAxis

SVector? TurnAxis get

Returns the Turn Axis (-1 to 1 on Vector's X value).


MouseLook

bool MouseLook get set

Enable or disable Mouse Look feature.

MouseX

float MouseX get

Returns a float representing the Mouse/Right Joystick horizontal movement. If the value is positive the movement is upwards. If the value is negative the movement is downwards. The value is derived by multiplying mouse delta with axis sensitivity. This is frame-rate independent; you do not need to be concerned about varying frame-rates when using this value.

MouseY

float MouseY get

Returns a float representing the Mouse/Right Joystick vertical movement. If the value is positive the movement is to the right. If the value is negative the movement is to the left. The value is derived by multiplying mouse delta with axis sensitivity. This is frame-rate independent; you do not need to be concerned about varying frame-rates when using this value.

ClickToWalk

SVector? TurnAxis get

Returns the Turn Axis (-1 to 1 on Vector's X value).

Fire

bool Fire get

Return true if primary fire is pressed (Mouselook Mode).

AltFire

bool AltFire get

Return true if alternative fire is pressed (Mouselook Mode)

CursorInUI

bool CursorInUI get

Returns true if the cursor is over the Sinespace UI.

IsVRAvailable

bool IsVRAvailable get

Returns true if VR is available.

IsVRActive

bool IsVRActive get

Returns true if VR is active.

VRLeftControllerPosition

SVector? VRLeftControllerPosition get

Returns position of Left VR Controller.

VRRightControllerPosition

SVector? VRRightControllerPosition get

Returns position of Right VR Controller.

VRLeftControllerRotation

SQuaternion? VRLeftControllerRotation get

Returns rotation of Left VR Controller.

VRRightControllerRotation

SQuaternion? VRRightControllerRotation get

Returns rotation of Right VR Controller.

Input Key Names

Key names follow these naming conventions:

Key family

Naming convention

Letter keys

a, b, c…

Number keys

1, 2, 3…

Arrow keys

up, down, left, right

Numpad keys

[1], [2], [3], [+], [equals]…

Modifier keys

right shift, left shift, right ctrl, left ctrl, right alt, left alt, right cmd, left cmd

Mouse buttons are named mouse 0, mouse 1, mouse 2, and so on.

Joystick buttons follow these naming conventions:

Button origin

Naming convention

A specific button on any joystick

joystick button 0, joystick button 1, joystick button 2…

A specific button on a specific joystick

joystick 1 button 0, joystick 1 button 1, joystick 2 button 0…

thisGameObject = Space.Host.ExecutingObject

OnUpdate = function()
  if Space.Input.GetKeyUp("space") then
 Space.Log("Jump Key Released")
  end
end

thisGameObject.OnUpdate(OnUpdate)
thisGameObject = Space.Host.ExecutingObject

OnUpdate = function()
  if Space.Input.GetKey("space") then
 Space.Log("Jump Key Held")
  end
end

thisGameObject.OnUpdate(OnUpdate)
if Space.Input.GetMouseDown(1) then
  Space.Log("Right Mouse button pressed in this frame")
end
--this script will make this object jump to wherever you right click
thisGameObject = Space.Host.ExecutingObject

OnUpdate = function()
  if Space.Input.GetMouseDown(1) then
   clickRay = Space.Camera.ScreenCoordinatesToRay(Space.Input.MousePosition)
  rayCastHit = Space.Physics.RayCastSingle(clickRay.Origin, clickRay.Direction, 50.0)
  thisGameObject.WorldPosition = rayCastHit.Position
  end
end

thisGameObject.OnUpdate(OnUpdate)  
if Space.Input.GetMouseUp(1) then
  Space.Log("Right Mouse button was just unpressed")
end
if Space.Input.GetMouseHold(1) then
  Space.Log("Right Mouse button being held")
end
--this script will make this object will follow your ovement while holding right click

thisGameObject = Space.Host.ExecutingObject


OnUpdate = function()
  if Space.Input.GetMouseHold(1) then
   clickRay = Space.Camera.ScreenCoordinatesToRay(Space.Input.MousePosition)
  rayCastHit = Space.Physics.RayCastSingle(clickRay.Origin, clickRay.Direction, 50.0)
  thisGameObject.WorldPosition = rayCastHit.Position
  end
end

thisGameObject.OnUpdate(OnUpdate)  
Space.Input.Vibrate(1,1,false)
scrollWheel = Space.Input.ScrollWheel
--Object will move up and down with scroll wheel movement
thisGameObject = Space.Host.ExecutingObject

OnUpdate = function()
  thisGameObject.WorldPosition = thisGameObject.WorldPosition + (thisGameObject.Up * Space.Input.ScrollWheel)
end

thisGameObject.OnUpdate(OnUpdate) 
currentMousePos = Space.Input.MousePosition
--Object will follow your mouse movement while holding right click
thisGameObject = Space.Host.ExecutingObject

OnUpdate = function()
  if Space.Input.GetMouseHold(1) then
    clickRay = Space.Camera.ScreenCoordinatesToRay(Space.Input.MousePosition)
    rayCastHit = Space.Physics.RayCastSingle(clickRay.Origin, clickRay.Direction, 50.0)
    thisGameObject.WorldPosition = rayCastHit.Position
  end
end

thisGameObject.OnUpdate(OnUpdate)   
moveAxis  = Space.Input.MovementAxis
--Object moves according to your AWSD presses

thisGameObject = Space.Host.ExecutingObject

OnUpdate = function()
  if Space.Input.MovementAxis.Y > 0 then
    thisGameObject.WorldPosition = thisGameObject.WorldPosition + thisGameObject.Forward
  elseif Space.Input.MovementAxis.Y < 0 then  
    thisGameObject.WorldPosition = thisGameObject.WorldPosition - thisGameObject.Forward 
  end

  if Space.Input.MovementAxis.X > 0 then
    thisGameObject.WorldPosition = thisGameObject.WorldPosition + thisGameObject.Right
  elseif Space.Input.MovementAxis.X < 0 then  
    thisGameObject.WorldPosition = thisGameObject.WorldPosition - thisGameObject.Right
  end
end

thisGameObject.OnUpdate(OnUpdate) 
turnAxis = Space.Input.TurnAxis
--makes this object color red if player is turning left
--and color green if player is turning right
--and blue if player is not turning
thisGameObject = Space.Host.ExecutingObject

OnUpdate = function()
  if Space.Input.TurnAxis.X > 0 then
    thisGameObject.Renderer.Material.SetColor("_Color",Color.Red)
  elseif Space.Input.TurnAxis.X < 0 then
    thisGameObject.Renderer.Material.SetColor("_Color",Color.Green)
  elseif Space.Input.TurnAxis.X == 0 then
    thisGameObject.Renderer.Material.SetColor("_Color",Color.Blue)
  end
end

thisGameObject.OnUpdate(OnUpdate)
Space.Input.MouseLook = true
--the below script will put your player into MouseLook mode if you are near the object 
--and return you to normal mode if you are far from the object 

thisGameObject = Space.Host.ExecutingObject

function OnUpdate()
  positionAvatar = Space.Scene.PlayerAvatar.GameObject.WorldPosition
  positionObject = thisGameObject.WorldPosition

  if positionAvatar.InRange(positionObject, 5.0) then
    if Space.Input.MouseLook == false then
      Space.Input.MouseLook = true
    end
  else
    if Space.Input.MouseLook == true then
      Space.Input.MouseLook = false
    end
  end

end  

thisGameObject.OnUpdate(OnUpdate)
MouseX = Space.Input.MouseX
--the below script will rotate this object along the Y axis 
--according to your mouse/right joystick horizontal movement

thisGameObject = Space.Host.ExecutingObject

function OnUpdate()
  currentY = thisGameObject.WorldRotation.EulerAngles.Y 
  newY = currentY + Space.Input.MouseX
  thisGameObject.WorldRotation = Quaternion.Euler(0, newY, 0)
end

thisGameObject.OnUpdate(OnUpdate) 
MouseY = Space.Input.MouseY
--the below script will rotate this object along the Y axis 
--according to your mouse/right joystick vertical movement

thisGameObject = Space.Host.ExecutingObject

function OnUpdate()
  currentX = thisGameObject.WorldRotation.EulerAngles.X 
  newX = currentX + Space.Input.MouseY
  thisGameObject.WorldRotation = Quaternion.Euler(newX , 0, 0)
end

thisGameObject.OnUpdate(OnUpdate) 
turnAxis = Space.Input.TurnAxis
--makes this object color red if player is turning left
fireIsPressed = Space.Input.Fire
--Create a GameObject from resource when Primary Fire button is pressed
--[Add resource "bullet" as a resource in scripting runtime component]

thisGameObject = Space.Host.ExecutingObject
bullet = Space.GetResource("bullet") 

OnUpdate = function()
  if Space.Input.Fire then
  Space.Scene.CreateGameObject(bullet) 
  end
end


thisGameObject.OnUpdate(OnUpdate)
altFireIsPressed = Space.Input.AltFire
--Create a GameObject from resource when Alternate Fire button is pressed
--[Add resource "bullet" as a resource in scripting runtime component]

thisGameObject = Space.Host.ExecutingObject
bullet = Space.GetResource("bullet") 

OnUpdate = function()
  if Space.Input.AltFire then
    Space.Scene.CreateGameObject(bullet) 
  end
end

thisGameObject.OnUpdate(OnUpdate)
cursorInUI = Space.Input.CursorInUI
--this object is going to listen to your scroll wheel movement and move accordingly
--UNLESS your cursor is on the sinespace UI
--(Example: Scrolling chat won't also move the object)

thisGameObject = Space.Host.ExecutingObject

OnUpdate = function()
  if Space.Input.CursorInUI == false then
    thisGameObject.WorldPosition = thisGameObject.WorldPosition + (thisGameObject.Up * Space.Input.ScrollWheel)
  end
end

thisGameObject.OnUpdate(OnUpdate)  
isAvailable = Space.Input.IsVRAvailable
turnAxis = Space.Input.TurnAxis
posVRleft = Space.Input.VRLeftControllerPosition
posVRright = Space.Input.VRRightControllerPosition
rotVRleft = Space.Input.VRLeftControllerRotation
rotVRright = Space.Input.VRRightControllerRotation
thisGameObject.OnUpdate(OnUpdate)

Special keys

backspace, tab, return, escape, space, delete, enter, insert, home, end, page up, page down

Function keys

f1, f2, f3…

Input key name
Input key name
Input key name

SUI

Functions

AddNotification

void AddNotification (string title, string text)

Shows a notification

Parameter
Type
Description

OpenAppearanceEditor

void OpenAppearanceEditor()

Opens the Appearance Editor (Outfit)

ShowPathToLocation

void ShowPathToLocation (string reason, location)

Shows a path to given location

Parameter
Type
Description

ShowLocation

void ShowLocation (string reason, location)

Shows given location

Parameter
Type
Description

AddGlobalActionButton

void AddGlobalActionButton (string button, string tooltip, Closure action)

Adds a "Global Action Button" which is a custom button you add to the UI that calls an action of your choice then clears after being clicked

Parameter
Type
Description

ClearGlobalActionButton

void ClearGlobalActionButton (string button)

Clears a previously added Global Action Button 'button'

Parameter
Type
Description

OpenQuestsWindow

void OpenQuestsWindow ()

Opens the Quests window. (white-label grid only)

HideQuestsWindow

void HideQuestsWindow ()

Hides the Quests window. (white-label grid only)

OpenSettingsWindow

void OpenSettingsWindow ()

Opens the Settings window. (white-label grid only)

HideSettingsWindow

void HideSettingsWindow ()

Hides the Settings window. (white-label grid only)

OpenFriendsWindow

void OpenFriendsWindow ()

Opens the Friends window. (white-label grid only)

HideFriendsWindow

void HideFriendsWindow ()

Hides the Friends window. (white-label grid only)

OpenExploreWindow

void OpenExploreWindow ()

Opens the Explore window. (white-label grid only)

HideExploreWindow

void HideExploreWindow ()

Hides the Explore window (white-label grid only)

OpenEventsWindow

void OpenEventsWindow ()

Opens the Events window (white-label grid only)

HideEventsWindow

void HideEventsWindow ()

Hides the Events window (white-label grid only)

OpenHomeWindow

void OpenHomeWindow ()

Opens the Home window (white-label grid only)

HideHomeWindow

void HideHomeWindow ()

Hides the Home window (white-label grid only)

OpenInventoryWindow

void OpenInventoryWindow ()

Opens the Inventory window (white-label grid only)

HideInventoryWindow

void HideInventoryWindow ()

Hides the Inventory window (white-label grid only)

OpenOutfitWindow

void OpenOutfitWindow ()

Opens the Outfit window (white-label grid only)

HideOutfitWindow

void HideOutfitWindow ()

Hides the Outfit window (white-label grid only)

OpenShopWindow

void OpenShopWindow ()

Opens the Shop window (white-label grid only)

HideShopWindow

void HideShopWindow ()

Hides the Shop window (white-label grid only)

OpenSnapshotWindow

void OpenSnapshotWindow ()

Opens the Snapshot window (white-label grid only)

HideSnapshotWindow

void HideSnapshotWindow ()

Hides the Snapshot window (white-label grid only)

OpenHelpWindow

void OpenHelpWindow ()

Opens the Help window (white-label grid only)

HideHelpWindow

void HideHelpWindow ()

Hides the Help window (white-label grid only)

OpenProfileWin

void OpenProfileWin ()

Opens the Profile window (white-label grid only)

HideProfileWindow

void HideProfileWindow()

Hides the Profile window (white-label grid only)

OpenUpgradeAccountWindow

void OpenUpgradeAccountWindow ()

Opens the Upgrade Account window (white-label grid only)

HideUpgradeAccountWindow

void HideUpgradeAccountWindow ()

Hides the Upgrade Account window (white-label grid only)

OpenRegionInfoWindow

void OpenRegionInfoWindow ()

Opens the Region Info window (white-label grid only)

HideRegionInfoWindow

void HideRegionInfoWindow ()

Hides the Region Info window (white-label grid only)

OpenExitWindow

void OpenExitWindow ()

Opens the Exit window (white-label grid only)

HideExitWindow

void HideExitWindow ()

Hides the Exit window (white-label grid only)

OpenMailWindow

void OpenMailWindow ()

Opens the Mail window (white-label grid only)

HideMailWindow

void HideMailWindow ()

Hides the Mail window (white-label grid only)

OpenFeedbackWindow

void OpenFeedbackWindow ()

Shows the Feedback window (white-label grid only)

HideFeedbackWindow

void HideFeedbackWindow ()

Hides the Feedback window (white-label grid only)

OpenBuyGoldWindow

void OpenBuyGoldWindow ()

Opens the Buy Gold window (white-label grid only)

HideBuyGoldWindow

void HideBuyGoldWindow ()

Hides the Buy Gold window (white-label grid only)

OpenChatWindow

void OpenChatWindow ()

Opens the Chat window (white-label grid only)

HideChatWindow

void HideChatWindow ()

Hides the Chat window (white-label grid only)

OpenRoomEditorWindow

void OpenRoomEditorWindow ()

Opens the Room Editor window (white-label grid only)

HideRoomEditorWindow

void HideRoomEditorWindow ()

Hides the Room Editor window (white-label grid only)

OpenDevicePicker

void OpenDevicePicker ()

Opens the Device Picker

OpenDeviceTester

void OpenDeviceTester ()

Opens the Device Tester

Raycast

SUIRaycastResult Raycast ()

Shoots a UI Raycast and returns the result as SUIRayCastResult

Properties

ShowUI

bool ShowUI get set

Show the User Interface

ShowWorldUI

bool ShowWorldUI get set

Show the World User Interface.

MusicVolume

int MusicVolume get set

Set/Get the Music volume (set: white-label grid only)

MasterVolume

int MasterVolume get set

Set/Get the Master volume (set: white-label grid only)

SFXVolume

int SFXVolume get set

Set/Get the SFX volume (set: white-label grid only)

UIVolume

int UIVolume get set

Set/Get the UI volume (set: white-label grid only)

VOIPVolume

int VOIPVolume get set

Set/Get the VOIP volume (set: white-label grid only)

ShowFriendsButton

bool ShowFriendsButton get set

Show the Friends button. (white-label grid only)

ShowExploreButton

bool ShowExploreButton get set

Show the Explore button. (white-label grid only)

ShowQuestsButton

bool ShowQuestsButton get set

Show the Quests button. (white-label grid only)

ShowInventoryButton

bool ShowInventoryButton get set

Show the Inventory button. (white-label grid only)

ShowOutfitButton

bool ShowOutfitButton get set

Set to true to show the Outfit button. (white-label grid only)

ShowShopButton

bool ShowShopButton get set

Show the Shop button. (white-label grid only)

ShowAuctionButton

bool ShowAuctionButton get set

Show the Auction button. (white-label grid only)

ShowSnapshotButton

bool ShowSnapshotButton get set

Show the Snapshot button.(white-label grid only)

ShowHelpButton

bool ShowHelpButton get set

Show the Help button. (white-label grid only)

ShowCurrencyButton

bool ShowCurrencyButton get set

Show the Currency button. (white-label grid only)

ShowGoldAndBuyButton

bool ShowGoldAndBuyButton get set

Show the Gold and Buy button. (white-label grid only)

ShowChat

bool ShowChat get set

Show the Chat. (white-label grid only)

ShowMiniMap

bool ShowMiniMap get set

Set to true to show the Minimap. (white-label grid only)

ShowHotBar

bool ShowHotBar get set

Show the Hot Bar. (white-label grid only)

ShowEventsButton

bool ShowEventsButton get set

Show the Events button. (white-label grid only)

ShowHomeButton

bool ShowHomeButton get set

Show the Home button. (white-label grid only)

ShowActivityPanel

bool ShowActivityPanel get set

Show the Activity Panel. (white-label grid only)

ShowProfileImage

bool ShowProfileImage get set

Show the Profile Image. (white-label grid only)

ShowRightButtonGroup

bool ShowRightButtonGroup get set

Show the Right Button Group. (white-label grid only)

ShowRoomInfoOption

bool ShowRoomInfoOption get set

Show the Room Info Option. (white-label grid only)

ShowSearch

bool ShowSearch get set

Show the Search bar. (white-label grid only)

ShowMailButton

bool ShowMailButton get set

Show the Mail button. (white-label grid only)

ShowNotificationButton

bool ShowNotificationButton get set

Show the Notification button. (white-label grid only)

ShowClock

bool ShowClock get set

Show the clock. (white-label grid only)

SVector
SVector
 Space.UI.AddNotification('Warning','This is a notification')
--This script will send a notification every time a new player joins region
--including the users name

function sendNotification(Av) 
Space.UI.AddNotification("New User","User joined: " .. Av.Username)
end

Space.Scene.OnPlayerJoin(sendNotification) 
Space.UI.OpenAppearanceEditor()
--This script will make a button open the Appearance Editor
--(example: tools for user to customize UI)
--[You need to add a UI Button as a reference in the Scripting Runtime Component]

theButton  = Space.Host.GetReference('TheButton')


OnClick = function()
  Space.UI.OpenAppearanceEditor()  
end

theButton.UIButton.OnClick(OnClick) 
Space.UI.ShowPathToLocation("A Reason", aLocation)
 Space.UI.ShowLocation("the reason", aLocation)
Space.UI.AddGlobalActionButton("Button 1", "Stand Up", aFunction)
 Space.UI.ClearGlobalActionButton("The Button")
--This script will make this object make you dance when clicked
--and also show a Global Action button to let you stop the dance (and clear that button)
--[required: Add the dance animation to the Scripting Runtime's "Resources" section with name "dance"]

thisObj = Space.Host.ExecutingObject
danceAnim = Space.GetResource("dance")
isDancing = false

gbClick = function()
 Space.Scene.PlayerAvatar.StopCustomAnimation()
 Space.UI.ClearGlobalActionButton("Stop Dance")
 isDancing = false
end

OnClick = function()
    if not isDancing then
    Space.Scene.PlayerAvatar.PlayCustomAnimation(danceAnim)  
    Space.UI.AddGlobalActionButton("Stop Dance","", gbClick)
    isDancing = true
    end
end


thisObj.AddClickable()
thisObj.Clickable.OnClick(OnClick)
Space.UI.OpenQuestsWindow()
example --This script will make a button show/hide the Quests Window
--(example: tools for user to customize UI)
--[You need to add a UI Button as a reference in the Scripting Runtime Component]

theButton  = Space.Host.GetReference('TheButton')
local isShown = false

OnClick = function()
  if isShown then
  Space.UI.HideQuestsWindow()
  isShown = false
  else
  Space.UI.OpenQuestsWindow()  
  isShown = true
  end
end

theButton.UIButton.OnClick(OnClick) 
Space.UI.HideQuestsWindow()
--This script will make a button show/hide the Quests Window
--(example: tools for user to customize UI)
--[You need to add a UI Button as a reference in the Scripting Runtime Component]

theButton  = Space.Host.GetReference('TheButton')
local isShown = false

OnClick = function()
  if isShown then
  Space.UI.HideQuestsWindow()
  isShown = false
  else
  Space.UI.OpenQuestsWindow()  
  isShown = true
  end
end

theButton.UIButton.OnClick(OnClick) 
Space.UI.OpenSettingsWindow()
--This script will make a button show/hide the Settings Window
--(example: tools for user to customize UI)
--[You need to add a UI Button as a reference in the Scripting Runtime Component]

theButton  = Space.Host.GetReference('TheButton')
local isShown = false

OnClick = function()
  if isShown then
  Space.UI.HideSettingsWindow()
  isShown = false
  else
  Space.UI.OpenSettingsWindow()  
  isShown = true
  end
end

theButton.UIButton.OnClick(OnClick) 
Space.UI.HideSettingsWindow()
--This script will make a button show/hide the Settings Window
--(example: tools for user to customize UI)
--[You need to add a UI Button as a reference in the Scripting Runtime Component]

theButton  = Space.Host.GetReference('TheButton')
local isShown = false

OnClick = function()
  if isShown then
  Space.UI.HideSettingsWindow()
  isShown = false
  else
  Space.UI.OpenSettingsWindow()  
  isShown = true
  end
end

theButton.UIButton.OnClick(OnClick) 
Space.UI.OpenFriendsWindow()
--This script will make a button show/hide the Friends Window--(example: tools for user to customize UI)--[You need to add a UI Button as a reference in the Scripting Runtime Component]theButton  = Space.Host.GetReference('TheButton')local isShown = falseOnClick = function()  if isShown then  Space.UI.HideFriendsWindow()  isShown = false  else  Space.UI.OpenFriendsWindow()    isShown = true  endendtheButton.UIButton.OnClick(OnClick)
HideFriendsWindow
Space.UI.HideFriendsWindow()
--This script will make a button show/hide the Friends Window
--(example: tools for user to customize UI)
--[You need to add a UI Button as a reference in the Scripting Runtime Component]

theButton  = Space.Host.GetReference('TheButton')
local isShown = false

OnClick = function()
  if isShown then
  Space.UI.HideFriendsWindow()
  isShown = false
  else
  Space.UI.OpenFriendsWindow()  
  isShown = true
  end
end

theButton.UIButton.OnClick(OnClick)
Space.UI.OpenExploreWindow()
--This script will make a button show/hide the Explore Window
--(example: tools for user to customize UI)
--[You need to add a UI Button as a reference in the Scripting Runtime Component]

theButton  = Space.Host.GetReference('TheButton')
local isShown = false

OnClick = function()
  if isShown then
  Space.UI.HideExploreWindow()
  isShown = false
  else
  Space.UI.OpenExploreWindow()  
  isShown = true
  end
end

theButton.UIButton.OnClick(OnClick) 
Space.UI.HideExploreWindow()
--This script will make a button show/hide the Explore Window
--(example: tools for user to customize UI)
--[You need to add a UI Button as a reference in the Scripting Runtime Component]

theButton  = Space.Host.GetReference('TheButton')
local isShown = false

OnClick = function()
  if isShown then
  Space.UI.HideExploreWindow()
  isShown = false
  else
  Space.UI.OpenExploreWindow()  
  isShown = true
  end
end

theButton.UIButton.OnClick(OnClick) 
Space.UI.OpenEventsWindow()
--This script will make a button show/hide the Events Window
--(example: tools for user to customize UI)
--[You need to add a UI Button as a reference in the Scripting Runtime Component]

theButton  = Space.Host.GetReference('TheButton')
local isShown = false

OnClick = function()
  if isShown then
  Space.UI.HideEventsWindow()
  isShown = false
  else
  Space.UI.OpenEventsWindow()  
  isShown = true
  end
end

theButton.UIButton.OnClick(OnClick)
Space.UI.HideEventsWindow()
--This script will make a button show/hide the Events Window
--(example: tools for user to customize UI)
--[You need to add a UI Button as a reference in the Scripting Runtime Component]

theButton  = Space.Host.GetReference('TheButton')
local isShown = false

OnClick = function()
  if isShown then
  Space.UI.HideEventsWindow()
  isShown = false
  else
  Space.UI.OpenEventsWindow()  
  isShown = true
  end
end

theButton.UIButton.OnClick(OnClick)
Space.UI.OpenHomeWindow()
--This script will make a button show/hide the Home Window
--(example: tools for user to customize UI)
--[You need to add a UI Button as a reference in the Scripting Runtime Component]

theButton  = Space.Host.GetReference('TheButton')
local isShown = false

OnClick = function()
  if isShown then
  Space.UI.HideHomeWindow()
  isShown = false
  else
  Space.UI.OpenHomeWindow()  
  isShown = true
  end
end

theButton.UIButton.OnClick(OnClick)
Space.UI.HideHomeWindow()
--This script will make a button show/hide the Home Window
--(example: tools for user to customize UI)
--[You need to add a UI Button as a reference in the Scripting Runtime Component]

theButton  = Space.Host.GetReference('TheButton')
local isShown = false

OnClick = function()
  if isShown then
  Space.UI.HideHomeWindow()
  isShown = false
  else
  Space.UI.OpenHomeWindow()  
  isShown = true
  end
end

theButton.UIButton.OnClick(OnClick)
Space.UI.OpenInventoryWindow()
--This script will make a button show/hide the Inventory Window
--(example: tools for user to customize UI)
--[You need to add a UI Button as a reference in the Scripting Runtime Component]

theButton  = Space.Host.GetReference('TheButton')
local isShown = false

OnClick = function()
  if isShown then
  Space.UI.HideInventoryWindow()
  isShown = false
  else
  Space.UI.OpenInventoryWindow()  
  isShown = true
  end
end

theButton.UIButton.OnClick(OnClick)
Space.UI.HideInventoryWindow()
--This script will make a button show/hide the Inventory Window
--(example: tools for user to customize UI)
--[You need to add a UI Button as a reference in the Scripting Runtime Component]

theButton  = Space.Host.GetReference('TheButton')
local isShown = false

OnClick = function()
  if isShown then
  Space.UI.HideInventoryWindow()
  isShown = false
  else
  Space.UI.OpenInventoryWindow()  
  isShown = true
  end
end

theButton.UIButton.OnClick(OnClick)
Space.UI.OpenOutfitWindow()
--This script will make a button show/hide the Outfit Window
--(example: tools for user to customize UI)
--[You need to add a UI Button as a reference in the Scripting Runtime Component]

theButton  = Space.Host.GetReference('TheButton')
local isShown = false

OnClick = function()
  if isShown then
  Space.UI.HideOutfitWindow()
  isShown = false
  else
  Space.UI.OpenOutfitWindow()  
  isShown = true
  end
end

theButton.UIButton.OnClick(OnClick)
Space.UI.HideOutfitWindow()
--This script will make a button show/hide the Outfit Window
--(example: tools for user to customize UI)
--[You need to add a UI Button as a reference in the Scripting Runtime Component]

theButton  = Space.Host.GetReference('TheButton')
local isShown = false

OnClick = function()
  if isShown then
  Space.UI.HideOutfitWindow()
  isShown = false
  else
  Space.UI.OpenOutfitWindow()  
  isShown = true
  end
end

theButton.UIButton.OnClick(OnClick)
Space.UI.OpenShopWindow()
--This script will make a button show/hide the Shop Window
--(example: tools for user to customize UI)
--[You need to add a UI Button as a reference in the Scripting Runtime Component]

theButton  = Space.Host.GetReference('TheButton')
local isShown = false

OnClick = function()
  if isShown then
  Space.UI.HideShopWindow()
  isShown = false
  else
  Space.UI.OpenShopWindow()  
  isShown = true
  end
end

theButton.UIButton.OnClick(OnClick)
Space.UI.HideShopWindow()
--This script will make a button show/hide the Shop Window
--(example: tools for user to customize UI)
--[You need to add a UI Button as a reference in the Scripting Runtime Component]

theButton  = Space.Host.GetReference('TheButton')
local isShown = false

OnClick = function()
  if isShown then
  Space.UI.HideShopWindow()
  isShown = false
  else
  Space.UI.OpenShopWindow()  
  isShown = true
  end
end

theButton.UIButton.OnClick(OnClick)
Space.UI.OpenSnapshotWindow()
--This script will make a button show/hide the Snapshot Window
--(example: tools for user to customize UI)
--[You need to add a UI Button as a reference in the Scripting Runtime Component]

theButton  = Space.Host.GetReference('TheButton')
local isShown = false

OnClick = function()
  if isShown then
  Space.UI.HideSnapshotWindow()
  isShown = false
  else
  Space.UI.OpenSnapshotWindow()  
  isShown = true
  end
end

theButton.UIButton.OnClick(OnClick)
Space.UI.HideSnapshotWindow()
--This script will make a button show/hide the Snapshot Window
--(example: tools for user to customize UI)
--[You need to add a UI Button as a reference in the Scripting Runtime Component]

theButton  = Space.Host.GetReference('TheButton')
local isShown = false

OnClick = function()
  if isShown then
  Space.UI.HideSnapshotWindow()
  isShown = false
  else
  Space.UI.OpenSnapshotWindow()  
  isShown = true
  end
end

theButton.UIButton.OnClick(OnClick)
Space.UI.OpenHelpWindow()
--This script will make a button show/hide the Help Window
--(example: tools for user to customize UI)
--[You need to add a UI Button as a reference in the Scripting Runtime Component]

theButton  = Space.Host.GetReference('TheButton')
local isShown = false

OnClick = function()
  if isShown then
  Space.UI.HideHelpWindow()
  isShown = false
  else
  Space.UI.OpenHelpWindow()  
  isShown = true
  end
end

theButton.UIButton.OnClick(OnClick)
Space.UI.HideHelpWindow()
--This script will make a button show/hide the Help Window
--(example: tools for user to customize UI)
--[You need to add a UI Button as a reference in the Scripting Runtime Component]

theButton  = Space.Host.GetReference('TheButton')
local isShown = false

OnClick = function()
  if isShown then
  Space.UI.HideHelpWindow()
  isShown = false
  else
  Space.UI.OpenHelpWindow()  
  isShown = true
  end
end

theButton.UIButton.OnClick(OnClick)
Space.UI.OpenProfileWin()
--This script will make a button show/hide the Profile Win
--(example: tools for user to customize UI)
--[You need to add a UI Button as a reference in the Scripting Runtime Component]

theButton  = Space.Host.GetReference('TheButton')
local isShown = false

OnClick = function()
  if isShown then
  Space.UI.HideProfileWindow()
  isShown = false
  else
  Space.UI.OpenProfileWin()  
  isShown = true
  end
end

theButton.UIButton.OnClick(OnClick)
Space.UI.HideProfileWindow()
--This script will make a button show/hide the Profile Win
--[You need to add a UI Button as a reference in the Scripting Runtime Component]

theButton  = Space.Host.GetReference('TheButton')
local isShown = false

OnClick = function()
  if isShown then
  Space.UI.HideProfileWindow()
  isShown = false
  else
  Space.UI.OpenProfileWin()  
  isShown = true
  end
end

theButton.UIButton.OnClick(OnClick)
Space.UI.OpenUpgradeAccountWindow()
--This script will make a button show/hide the Upgrade Account Window
--(example: tools for user to customize UI)
--[You need to add a UI Button as a reference in the Scripting Runtime Component]

theButton  = Space.Host.GetReference('TheButton')
local isShown = false

OnClick = function()
  if isShown then
  Space.UI.HideUpgradeAccountWindow()
  isShown = false
  else
  Space.UI.OpenUpgradeAccountWindow()  
  isShown = true
  end
end

theButton.UIButton.OnClick(OnClick)
Space.UI.HideUpgradeAccountWindow()
--This script will make a button show/hide the Upgrade Account Window
--(example: tools for user to customize UI)
--[You need to add a UI Button as a reference in the Scripting Runtime Component]

theButton  = Space.Host.GetReference('TheButton')
local isShown = false

OnClick = function()
  if isShown then
  Space.UI.HideUpgradeAccountWindow()
  isShown = false
  else
  Space.UI.OpenUpgradeAccountWindow()  
  isShown = true
  end
end

theButton.UIButton.OnClick(OnClick)
Space.UI.OpenRegionInfoWindow()
--This script will make a button show/hide the Region Info Window
--(example: tools for user to customize UI)
--[You need to add a UI Button as a reference in the Scripting Runtime Component]

theButton  = Space.Host.GetReference('TheButton')
local isShown = false

OnClick = function()
  if isShown then
  Space.UI.HideRegionInfoWindow()
  isShown = false
  else
  Space.UI.OpenRegionInfoWindow()  
  isShown = true
  end
end

theButton.UIButton.OnClick(OnClick)
Space.UI.HideRegionInfoWindow()
--This script will make a button show/hide the Region Info Window
--(example: tools for user to customize UI)
--[You need to add a UI Button as a reference in the Scripting Runtime Component]

theButton  = Space.Host.GetReference('TheButton')
local isShown = false

OnClick = function()
  if isShown then
  Space.UI.HideRegionInfoWindow()
  isShown = false
  else
  Space.UI.OpenRegionInfoWindow()  
  isShown = true
  end
end

theButton.UIButton.OnClick(OnClick)
Space.UI.OpenExitWindow()
--This script will make a button show/hide the Exit Window
--(example: tools for user to customize UI)
--[You need to add a UI Button as a reference in the Scripting Runtime Component]

theButton  = Space.Host.GetReference('TheButton')
local isShown = false

OnClick = function()
  if isShown then
  Space.UI.HideExitWindow()
  isShown = false
  else
  Space.UI.OpenExitWindow()  
  isShown = true
  end
end

theButton.UIButton.OnClick(OnClick)
Space.UI.HideExitWindow()
--This script will make a button show/hide the Exit Window
--(example: tools for user to customize UI)
--[You need to add a UI Button as a reference in the Scripting Runtime Component]

theButton  = Space.Host.GetReference('TheButton')
local isShown = false

OnClick = function()
  if isShown then
  Space.UI.HideExitWindow()
  isShown = false
  else
  Space.UI.OpenExitWindow()  
  isShown = true
  end
end

theButton.UIButton.OnClick(OnClick)
Space.UI.OpenMailWindow()
--This script will make a button show/hide the Mail Window
--(example: tools for user to customize UI)
--[You need to add a UI Button as a reference in the Scripting Runtime Component]

theButton  = Space.Host.GetReference('TheButton')
local isShown = false

OnClick = function()
  if isShown then
  Space.UI.HideMailWindow()
  isShown = false
  else
  Space.UI.OpenMailWindow()  
  isShown = true
  end
end

theButton.UIButton.OnClick(OnClick)
Space.UI.HideMailWindow()
--This script will make a button show/hide the Mail Window
--(example: tools for user to customize UI)
--[You need to add a UI Button as a reference in the Scripting Runtime Component]

theButton  = Space.Host.GetReference('TheButton')
local isShown = false

OnClick = function()
  if isShown then
  Space.UI.HideMailWindow()
  isShown = false
  else
  Space.UI.OpenMailWindow()  
  isShown = true
  end
end

theButton.UIButton.OnClick(OnClick)
Space.UI.OpenFeedbackWindow()
--This script will make a button show/hide the Feedback Window
--(example: tools for user to customize UI)
--[You need to add a UI Button as a reference in the Scripting Runtime Component]

theButton  = Space.Host.GetReference('TheButton')
local isShown = false

OnClick = function()
  if isShown then
  Space.UI.HideFeedbackWindow()
  isShown = false
  else
  Space.UI.OpenFeedbackWindow()  
  isShown = true
  end
end

theButton.UIButton.OnClick(OnClick)
Space.UI.HideFeedbackWindow()
--This script will make a button show/hide the Mail Window
--(example: tools for user to customize UI)
--[You need to add a UI Button as a reference in the Scripting Runtime Component]

theButton  = Space.Host.GetReference('TheButton')
local isShown = false

OnClick = function()
  if isShown then
  Space.UI.HideFeedbackWindow()
  isShown = false
  else
  Space.UI.OpenFeedbackWindow()  
  isShown = true
  end
end

theButton.UIButton.OnClick(OnClick)
Space.UI.OpenBuyGoldWindow()
--This script will make a button show/hide the Buy Gold Window
--(example: tools for user to customize UI)
--[You need to add a UI Button as a reference in the Scripting Runtime Component]

theButton  = Space.Host.GetReference('TheButton')
local isShown = false

OnClick = function()
  if isShown then
  Space.UI.HideBuyGoldWindow()
  isShown = false
  else
  Space.UI.OpenBuyGoldWindow()  
  isShown = true
  end
end

theButton.UIButton.OnClick(OnClick)
Space.UI.HideBuyGoldWindow()
--This script will make a button show/hide the Buy Gold Window
--(example: tools for user to customize UI)
--[You need to add a UI Button as a reference in the Scripting Runtime Component]

theButton  = Space.Host.GetReference('TheButton')
local isShown = false

OnClick = function()
  if isShown then
  Space.UI.HideBuyGoldWindow()
  isShown = false
  else
  Space.UI.OpenBuyGoldWindow()  
  isShown = true
  end
end

theButton.UIButton.OnClick(OnClick)
Space.UI.OpenChatWindow()
--This script will make a button show/hide the Chat Window
--(example: tools for user to customize UI)
--[You need to add a UI Button as a reference in the Scripting Runtime Component]

theButton  = Space.Host.GetReference('TheButton')
local isShown = false

OnClick = function()
  if isShown then
  Space.UI.HideChatWindow()
  isShown = false
  else
  Space.UI.OpenChatWindow()  
  isShown = true
  end
end

theButton.UIButton.OnClick(OnClick)
Space.UI.HideChatWindow()
--This script will make a button show/hide the Chat Window
--(example: tools for user to customize UI)
--[You need to add a UI Button as a reference in the Scripting Runtime Component]

theButton  = Space.Host.GetReference('TheButton')
local isShown = true

OnClick = function()
  if isShown then
  Space.UI.HideChatWindow()
  isShown = false
  else
  Space.UI.OpenChatWindow()  
  isShown = true
  end
end

theButton.UIButton.OnClick(OnClick)
Space.UI.OpenRoomEditorWindow()
--This script will make a button show/hide the Room Editor Window
--(example: tools for user to customize UI)
--[You need to add a UI Button as a reference in the Scripting Runtime Component]

theButton  = Space.Host.GetReference('TheButton')
local isShown = false

OnClick = function()
  if isShown then
  Space.UI.HideRoomEditorWindow()
  isShown = false
  else
  Space.UI.OpenRoomEditorWindow()  
  isShown = true
  end
end

theButton.UIButton.OnClick(OnClick)
Space.UI.HideRoomEditorWindow()
--This script will make a button show/hide the Room Editor Window
--(example: tools for user to customize UI)
--[You need to add a UI Button as a reference in the Scripting Runtime Component]

theButton  = Space.Host.GetReference('TheButton')
local isShown = false

OnClick = function()
  if isShown then
  Space.UI.HideRoomEditorWindow()
  isShown = false
  else
  Space.UI.OpenRoomEditorWindow()  
  isShown = true
  end
end

theButton.UIButton.OnClick(OnClick)
Space.UI.OpenDevicePicker()
--This script will make a button open the Device Picker
--[You need to add a UI Button as a reference in the Scripting Runtime Component]

theButton  = Space.Host.GetReference('TheButton')

OnClick = function()
  Space.UI.OpenDevicePicker()  
end

theButton.UIButton.OnClick(OnClick)
Space.UI.OpenDeviceTester()
RayCastResult = Space.UI.Raycast()
--This script will update a UIText element with the result of a UIRaycast whenever...
--the player clicks on a Sinespace UI element
thisObject = Space.Host.ExecutingObject
uiText = Space.Host.GetReference("text").UIText --Add this object with UIText component as reference in Scripting Runtime



OnUpdate = function()

  if Space.Input.GetMouseDown(0) == true then
  result = Space.UI.Raycast()	
    if result.IsValid then 
      uiText = result.ToString()
    end
  end
end


thisObject.OnUpdate(OnUpdate)
Space.UI.ShowUI = false
--This script will make a UI Toggle show/hide theUser Interface
--[You need to add an object with UI Toggle as a reference (scripting runtime)]

toggle = Space.Host.GetReference("Toggle").UIToggle


OnValueChanged = function()
  if toggle.IsOn then
    Space.UI.ShowUI= true
  else
    Space.UI.ShowUI= false
  end
end

toggle.OnValueChanged(OnValueChanged)
Space.UI.ShowWorldUI = false
--This script will make a UI Toggle show/hide the World UI
--(example: tools for user to customize UI)
--[You need to add an object with UI Toggle as a reference (scripting runtime)]

toggle = Space.Host.GetReference("Toggle").UIToggle


OnValueChanged = function()
  if toggle.IsOn then
    Space.UI.ShowWorldUI= true
  else
    Space.UI.ShowWorldUI= false
  end
end

toggle.OnValueChanged(OnValueChanged)
MusicVolume = Space.UI.MusicVolume
--This script will make moving a slider control the Music Volume
--and also update a text field with the current Music Volume
--(example: custom UI)
--[You need to add the slider and text field as a reference]

slider = Space.Host.GetReference("Slider").UISlider
textField = Space.Host.GetReference("Text Field").UIText


OnValueChanged = function()
Space.UI.MusicVolume = slider.NormalizedValue * 100
textField.Text = Space.UI.MusicVolume
end

slider.OnValueChanged(OnValueChanged)
MasterVolume = Space.UI.MasterVolume
--This script will make moving a slider control the Master Volume
--and also update a text field with the current Master Volume
--(example: custom UI)
--[You need to add the slider and text field as a reference]

slider = Space.Host.GetReference("Slider").UISlider
textField = Space.Host.GetReference("Text Field").UIText


OnValueChanged = function()
Space.UI.MasterVolume = slider.NormalizedValue * 100
textField.Text = Space.UI.MasterVolume
end

slider.OnValueChanged(OnValueChanged)
SFXVolume = Space.UI.SFXVolume
--This script will make moving a slider control the SFX Volume
--and also update a text field with the current SFX Volume
--(example: custom UI)
--[You need to add the slider and text field as a reference]

slider = Space.Host.GetReference("Slider").UISlider
textField = Space.Host.GetReference("Text Field").UIText


OnValueChanged = function()
Space.UI.SFXVolume = slider.NormalizedValue * 100
textField.Text = Space.UI.SFXVolume
end

slider.OnValueChanged(OnValueChanged)
UIVolume = Space.UI.UIVolume
--This script will make moving a slider control the UI Volume
--and also update a text field with the current UI Volume
--[You need to add the slider and text field as a reference]

slider = Space.Host.GetReference("Slider").UISlider
textField = Space.Host.GetReference("Text Field").UIText


OnValueChanged = function()
Space.UI.UIVolume = slider.NormalizedValue * 100
textField.Text = Space.UI.UIVolume
end

slider.OnValueChanged(OnValueChanged)
VOIPVolume = Space.UI.VOIPVolume
 --This script will make moving a slider control the Voice Volume
--and also update a text field with the current Voice Volume
--[You need to add the slider and text field as a reference]

slider = Space.Host.GetReference("Slider").UISlider
textField = Space.Host.GetReference("Text Field").UIText


OnValueChanged = function()
Space.UI.VOIPVolume = slider.NormalizedValue * 100
textField.Text = Space.UI.VOIPVolume
end

slider.OnValueChanged(OnValueChanged) 
Space.UI.ShowFriendsButton = false
--This script will make a UI Toggle show/hide the Friends Button
--(example: tools for user to customize UI)
--[You need to add an object with UI Toggle as a reference (scripting runtime)]

toggle = Space.Host.GetReference("Toggle").UIToggle


OnValueChanged = function()
  if toggle.IsOn then
    Space.UI.ShowFriendsButton = true
  else
    Space.UI.ShowFriendsButton = false
  end
end

toggle.OnValueChanged(OnValueChanged)
Space.UI.ShowExploreButton = false
--This script will make a UI Toggle show/hide the Explore Button
--(example: tools for user to customize UI)
--[You need to add an object with UI Toggle as a reference (scripting runtime)]

toggle = Space.Host.GetReference("Toggle").UIToggle


OnValueChanged = function()
  if toggle.IsOn then
    Space.UI.ShowExploreButton = true
  else
    Space.UI.ShowExploreButton = false
  end
end

toggle.OnValueChanged(OnValueChanged)
Space.UI.ShowQuestsButton = false
--This script will make a UI Toggle show/hide the Quests button
--(example: tools for user to customize UI)
--[You need to add an object with UI Toggle as a reference (scripting runtime)]

toggle = Space.Host.GetReference("Toggle").UIToggle


OnValueChanged = function()
  if toggle.IsOn then
    Space.UI.ShowQuestsButton= true
  else
    Space.UI.ShowQuestsButton= false
  end
end

toggle.OnValueChanged(OnValueChanged)
Space.UI.ShowInventoryButton = false
--This script will make a UI Toggle show/hide the Inventory Button
--(example: tools for user to customize UI)
--[You need to add an object with UI Toggle as a reference (scripting runtime)]

toggle = Space.Host.GetReference("Toggle").UIToggle


OnValueChanged = function()
  if toggle.IsOn then
    Space.UI.ShowInventoryButton= true
  else
    Space.UI.ShowInventoryButton= false
  end
end

toggle.OnValueChanged(OnValueChanged)
Space.UI.ShowOutfitButton = false
--This script will make a UI Toggle show/hide the Outfit Button
--(example: tools for user to customize UI)
--[You need to add an object with UI Toggle as a reference (scripting runtime)]

toggle = Space.Host.GetReference("Toggle").UIToggle


OnValueChanged = function()
  if toggle.IsOn then
    Space.UI.ShowOutfitButton= true
  else
    Space.UI.ShowOutfitButton= false
  end
end

toggle.OnValueChanged(OnValueChanged)
Space.UI.ShowShopButton = false
--This script will make a UI Toggle show/hide the Shop Button
--(example: tools for user to customize UI)
--[You need to add an object with UI Toggle as a reference (scripting runtime)]

toggle = Space.Host.GetReference("Toggle").UIToggle


OnValueChanged = function()
  if toggle.IsOn then
    Space.UI.ShowShopButton= true
  else
    Space.UI.ShowShopButton= false
  end
end

toggle.OnValueChanged(OnValueChanged)
Space.UI.ShowAuctionButton = false
--This script will make a UI Toggle show/hide the Auction Button
--(example: tools for user to customize UI)
--[You need to add an object with UI Toggle as a reference (scripting runtime)]

toggle = Space.Host.GetReference("Toggle").UIToggle


OnValueChanged = function()
  if toggle.IsOn then
    Space.UI.ShowAuctionButton = true
  else
    Space.UI.ShowAuctionButton = false
  end
end

toggle.OnValueChanged(OnValueChanged)
Space.UI.ShowSnapshotButton = false
--This script will make a UI Toggle show/hide the Snapshot Button
--(example: tools for user to customize UI)
--[You need to add an object with UI Toggle as a reference (scripting runtime)]

toggle = Space.Host.GetReference("Toggle").UIToggle


OnValueChanged = function()
  if toggle.IsOn then
    Space.UI.ShowSnapshotButton= true
  else
    Space.UI.ShowSnapshotButton= false
  end
end

toggle.OnValueChanged(OnValueChanged)
Space.UI.ShowHelpButton = false
--This script will make a UI Toggle show/hide the Help Button
--(example: tools for user to customize UI)
--[You need to add an object with UI Toggle as a reference (scripting runtime)]

toggle = Space.Host.GetReference("Toggle").UIToggle


OnValueChanged = function()
  if toggle.IsOn then
    Space.UI.ShowHelpButton= true
  else
    Space.UI.ShowHelpButton= false
  end
end

toggle.OnValueChanged(OnValueChanged)
Space.UI.ShowCurrencyButton = false
--This script will make a UI Toggle show/hide the Currency Button
--(example: tools for user to customize UI)
--[You need to add an object with UI Toggle as a reference (scripting runtime)]

toggle = Space.Host.GetReference("Toggle").UIToggle


OnValueChanged = function()
  if toggle.IsOn then
    Space.UI.ShowCurrencyButton= true
  else
    Space.UI.ShowCurrencyButton= false
  end
end

toggle.OnValueChanged(OnValueChanged)
Space.UI.ShowGoldAndBuyButton = false
--This script will make a UI Toggle show/hide the Gold and Buy button
--(example: tools for user to customize UI)
--[You need to add an object with UI Toggle as a reference (scripting runtime)]

toggle = Space.Host.GetReference("Toggle").UIToggle


OnValueChanged = function()
  if toggle.IsOn then
    Space.UI.ShowGoldAndBuyButton= true
  else
    Space.UI.ShowGoldAndBuyButton= false
  end
end

toggle.OnValueChanged(OnValueChanged)
Space.UI.ShowChat = false
--This script will make a UI Toggle show/hide the Chat
--(example: tools for user to customize UI)
--[You need to add an object with UI Toggle as a reference (scripting runtime)]

toggle = Space.Host.GetReference("Toggle").UIToggle


OnValueChanged = function()
  if toggle.IsOn then
    Space.UI.ShowChat= true
  else
    Space.UI.ShowChat= false
  end
end

toggle.OnValueChanged(OnValueChanged)
Space.UI.ShowMiniMap = false
--This script will make a UI Toggle show/hide the Minimap
--(example: tools for user to customize UI)
--[You need to add an object with UI Toggle as a reference (scripting runtime)]

toggle = Space.Host.GetReference("Toggle").UIToggle


OnValueChanged = function()
  if toggle.IsOn then
    Space.UI.ShowMiniMap= true
  else
    Space.UI.ShowMiniMap= false
  end
end

toggle.OnValueChanged(OnValueChanged)
Space.UI.ShowHotBar = false
--This script will make a UI Toggle show/hide the Hot Bar
--(example: tools for user to customize UI)
--[You need to add an object with UI Toggle as a reference (scripting runtime)]

toggle = Space.Host.GetReference("Toggle").UIToggle


OnValueChanged = function()
  if toggle.IsOn then
    Space.UI.ShowHotBar= true
  else
    Space.UI.ShowHotBar= false
  end
end

toggle.OnValueChanged(OnValueChanged)
Space.UI.ShowEventsButton = false
--This script will make a UI Toggle show/hide the  Events button
--[You need to add an object with UI Toggle as a reference (scripting runtime)]

toggle = Space.Host.GetReference("Toggle").UIToggle


OnValueChanged = function()
  if toggle.IsOn then
    Space.UI.ShowEventsButton= true
  else
    Space.UI.ShowEventsButton= false
  end
end

toggle.OnValueChanged(OnValueChanged)
Space.UI.ShowHomeButton = false
--This script will make a UI Toggle show/hide the Home Button
--(example: tools for user to customize UI)
--[You need to add an object with UI Toggle as a reference (scripting runtime)]

toggle = Space.Host.GetReference("Toggle").UIToggle


OnValueChanged = function()
  if toggle.IsOn then
    Space.UI.ShowHomeButton= true
  else
    Space.UI.ShowHomeButton= false
  end
end

toggle.OnValueChanged(OnValueChanged)
Space.UI.ShowActivityPanel = false
--This script will make a UI Toggle show/hide the Activity Panel
--[You need to add an object with UI Toggle as a reference (scripting runtime)]

toggle = Space.Host.GetReference("Toggle").UIToggle

OnValueChanged = function()
  if toggle.IsOn then
    Space.UI.ShowActivityPanel= true
  else
    Space.UI.ShowActivityPanel= false
  end
end

toggle.OnValueChanged(OnValueChanged)
Space.UI.ShowProfileImage = false
--This script will make a UI Toggle show/hide the Profile Image
--(example: tools for user to customize UI)
--[You need to add an object with UI Toggle as a reference (scripting runtime)]

toggle = Space.Host.GetReference("Toggle").UIToggle


OnValueChanged = function()
  if toggle.IsOn then
    Space.UI.ShowProfileImage= true
  else
    Space.UI.ShowProfileImage= false
  end
end

toggle.OnValueChanged(OnValueChanged)
Space.UI.ShowRightButtonGroup = false
--This script will make a UI Toggle show/hide the Right Button Group
--(example: tools for user to customize UI)
--[You need to add an object with UI Toggle as a reference (scripting runtime)]

toggle = Space.Host.GetReference("Toggle").UIToggle


OnValueChanged = function()
  if toggle.IsOn then
    Space.UI.ShowRightButtonGroup= true
  else
    Space.UI.ShowRightButtonGroup= false
  end
end

toggle.OnValueChanged(OnValueChanged)
Space.UI.ShowRoomInfoOption = false
--This script will make a UI Toggle show/hide the Room Info Option
--[You need to add an object with UI Toggle as a reference (scripting runtime)]

toggle = Space.Host.GetReference("Toggle").UIToggle


OnValueChanged = function()
  if toggle.IsOn then
    Space.UI.ShowRoomInfoOption= true
  else
    Space.UI.ShowRoomInfoOption= false
  end
end

toggle.OnValueChanged(OnValueChanged)
Space.UI.ShowSearch = false
--This script will make a UI Toggle show/hide the Search Bar
--(example: tools for user to customize UI)
--[You need to add an object with UI Toggle as a reference (scripting runtime)]

toggle = Space.Host.GetReference("Toggle").UIToggle


OnValueChanged = function()
  if toggle.IsOn then
    Space.UI.ShowSearch= true
  else
    Space.UI.ShowSearch= false
  end
end

toggle.OnValueChanged(OnValueChanged)
Space.UI.ShowMailButton = false
--This script will make a UI Toggle show/hide the Mail Button
--(example: tools for user to customize UI)
--[You need to add an object with UI Toggle as a reference (scripting runtime)]

toggle = Space.Host.GetReference("Toggle").UIToggle


OnValueChanged = function()
  if toggle.IsOn then
    Space.UI.ShowMailButton = true
  else
    Space.UI.ShowMailButton = false
  end
end

toggle.OnValueChanged(OnValueChanged)
Space.UI.ShowNotificationButton = false
 --This script will make a UI Toggle show/hide the Notification Button
--(example: tools for user to customize UI)
--[You need to add an object with UI Toggle as a reference (scripting runtime)]

toggle = Space.Host.GetReference("Toggle").UIToggle


OnValueChanged = function()
  if toggle.IsOn then
    Space.UI.ShowNotificationButton= true
  else
    Space.UI.ShowNotificationButton= false
  end
end

toggle.OnValueChanged(OnValueChanged) 
Space.UI.ShowClock = false
--This script will make a UI Toggle show/hide the Clock
--(example: tools for user to customize UI)
--[You need to add an object with UI Toggle as a reference (scripting runtime)]

toggle = Space.Host.GetReference("Toggle").UIToggle


OnValueChanged = function()
  if toggle.IsOn then
    Space.UI.ShowClock= true
  else
    Space.UI.ShowClock= false
  end
end

toggle.OnValueChanged(OnValueChanged)