SRegionScript

Index

Functions Index

Function

void Log (string message)

void SubscribeToNetwork (string key)

void UnsubscribeFromNetwork (string key)

void SendMessageToAllClientScripts (string messageName, Table message)

void SendMessageToClientScripts (ulong playerID, string messageName, Table message)

void StartCoroutine (DynValue coroutine, DynValue parameter=default(DynValue)) void StartCoroutine (string name, DynValue parameter=default(DynValue))

Properties Index

Property

string ScriptID get

uint InstanceID get

ulong RegionID get

SScene Scene get

SDatabase Database get

SMath Math get

SShared Shared get

SWebservice WebServices get

string RuntimeType get

bool InEditor get

string DateTimeUTC get

Events Index

Event

Action< int > OnAvatarJoin

Action< int > OnAvatarLeave

Action< string, Table > OnScriptServerMessage

Functions

Log

void Log (string message)

Log a message to console. (only works on preview grid)

Parameter
Type
Description

SubscribeToNetwork

void SubscribeToNetwork (string key)

Subscribe to network messages on "key".

Parameter
Type
Description

UnsubscribeFromNetwork

void UnsubscribeFromNetwork (string key)

Unsubscribe from network messages on "key".

Parameter
Type
Description

SendMessageToAllClientScripts

void SendMessageToAllClientScripts (string messageName, Table message)

Sends a network message to all client scripts.

Parameter
Type
Description

SendMessageToClientScripts

void SendMessageToClientScripts (ulong playerID, string messageName, Table message)

Sends a network message to a client script belonging to a specific player

Parameter
Type
Description

StartCoroutine

void StartCoroutine (DynValue coroutine, DynValue parameter=default(DynValue)) void StartCoroutine (string name, DynValue parameter=default(DynValue))

Runs the given function as a coroutine. A parameter is optional.

Parameter
Type
Description

Properties

ScriptID

string ScriptID get

Returns a unique identifier of this script runtime. (can be found in "/list_scripts" window on preview.)

InstanceID

uint InstanceID get

Returns a unique identifier for the instance of the region. Useful in the case of multiple shards/instances being used. InstanceID does not necessarily equal to the RegionID, even if there's only one instance running.

RegionID

ulong RegionID get

Returns a unique identifier for the region. (Same ID seen in curator)

Scene

SScene Scene get

Access to the SScene class methods and properties.

Database

SDatabase Database get

Access to the SDatabase class methods and properties.

Math

SMath Math get

Access to the SMath class methods and properties.

Shared

SShared Shared get

Access to the SShared class methods and properties.

WebServices

SWebservice WebServices get

Access to the SWebservice class methods and properties.

RuntimeType

string RuntimeType get

Returns "Server" if this script is a Server script

InEditor

bool InEditor get

Returns true if in Editor. (this will return false on server scripts)

TimeSinceAwake

float TimeSinceAwake get

Time, in seconds, since this script runtime has been awake.

DateTimeUTC

string DateTimeUTC get

Returns a string of the current Date/Time in UTC

LocalTimeUnix

int LocalTimeUnix get

Returns the current Unix time (in seconds) (same as ServerTimeUnix)

ServerTimeUnix

int ServerTimeUnix get

Returns the current Unix time (in seconds) (same as LocalTimeUnix)

Events

OnAvatarJoin

Action< int > OnAvatarJoin

An event function which will be called whenever an Avatar joins and will also contain the Avatar's ID as a parameter.

OnAvatarLeave

Action< int > OnAvatarLeave

An event function which will be called whenever an Avatar leaves and will also contain the Avatar's ID as a parameter.

OnScriptServerMessage

Action< string, Table > OnScriptServerMessage

An event function which will be called whenever the server script receives a Network Message, and will contain the network message key String and message Table as a parameter.

Last updated

Was this helpful?