|
|
Line 1: |
Line 1: |
− | =Members=
| + | This page has moved to: https://docs.sine.space/v/scripting/client-scripting/network/schat |
− | | + | |
− | {{ScriptFunction|void|JoinChat|(string name);|Join a chat channel.|5=
| + | |
− | Space.Network.Chat.JoinChat("Test room")|6=<pre>--this script will make the player join a chat when entering a trigger collider and leave it when leaving
| + | |
− | --[Requires this object to have a "Trigger" collider]
| + | |
− | | + | |
− | thisObject = Space.Host.ExecutingObject
| + | |
− | thisPlayer = Space.Scene.PlayerAvatar
| + | |
− | | + | |
− | OTS = function(gameObject)
| + | |
− | if gameObject.Avatar ~= nil and thisPlayer == gameObject.Avatar then
| + | |
− | | + | |
− | Space.Network.Chat.JoinChat("PrivateChatZone")
| + | |
− |
| + | |
− | end
| + | |
− | | + | |
− | end
| + | |
− | | + | |
− | OTE = function(gameObject)
| + | |
− | if gameObject.Avatar ~= nil and thisPlayer == gameObject.Avatar then
| + | |
− | | + | |
− | Space.Network.Chat.LeaveChat("PrivateChatZone")
| + | |
− |
| + | |
− | end
| + | |
− |
| + | |
− | end
| + | |
− | | + | |
− | | + | |
− | thisObject.OnTriggerStart(OTS)
| + | |
− | thisObject.OnTriggerExit(OTE)</pre>
| + | |
− | }}
| + | |
− | | + | |
− | {{ScriptFunction|void|LeaveChat|(string name);|Leave a chat channel.|5=
| + | |
− | Space.Network.Chat.LeaveChat("Test room")|6=<pre>--this script will make the player join a chat when entering a trigger collider and leave it when leaving
| + | |
− | --[Requires this object to have a "Trigger" collider]
| + | |
− | | + | |
− | thisObject = Space.Host.ExecutingObject
| + | |
− | thisPlayer = Space.Scene.PlayerAvatar
| + | |
− | | + | |
− | OTS = function(gameObject)
| + | |
− | if gameObject.Avatar ~= nil and thisPlayer == gameObject.Avatar then
| + | |
− | | + | |
− | Space.Network.Chat.JoinChat("PrivateChatZone")
| + | |
− |
| + | |
− | end
| + | |
− | | + | |
− | end
| + | |
− | | + | |
− | OTE = function(gameObject)
| + | |
− | if gameObject.Avatar ~= nil and thisPlayer == gameObject.Avatar then
| + | |
− | | + | |
− | Space.Network.Chat.LeaveChat("PrivateChatZone")
| + | |
− |
| + | |
− | end
| + | |
− |
| + | |
− | end
| + | |
− | | + | |
− | | + | |
− | thisObject.OnTriggerStart(OTS)
| + | |
− | thisObject.OnTriggerExit(OTE)</pre>
| + | |
− | }}
| + | |
− | | + | |
− | {{ScriptFunction|void|OnChat|(Action< SChatMessage > callback);| Bind a function to the OnChat event. This function will be called every time a new chat message is received on the local channel.|5=<pre>Space.Network.Chat.OnChat(OnChatFunction) </pre>|6=<pre>--this script takes every new chat message and displays it in a UIText
| + | |
− | uiText = Space.Host.GetReference("text").UIText --Add this Text object as reference in Scripting Runtime
| + | |
− | | + | |
− | OnChatFunction = function(SChatMessage)
| + | |
− | uiText.Text = SChatMessage.Sender ..": " .. SChatMessage.Message
| + | |
− | end
| + | |
− | | + | |
− | Space.Network.Chat.OnChat(OnChatFunction) </pre>
| + | |
− | }}
| + | |
− | | + | |
− | | + | |
− | | + | |
− | {{ScriptFunction|string|GetXMPPName|(string name);|Get XMPP name.|5=
| + | |
− | Space.Network.Chat.GetXMPPName("Test room")
| + | |
− | }}
| + | |
− | | + | |
− | | + | |
− | {{ScriptFunction|void|JoinVoice|(string channel, int prioroty<nowiki>=</nowiki>5, int spatial<nowiki>=</nowiki> 0);|Join a voice chat channel.|5=
| + | |
− | Space.Network.Chat.JoinVoice("PrivateVoiceZone")|6=<pre>--this script will make the player join a voice channel when entering a trigger collider and leave it when leaving
| + | |
− | --[Requires this object to have a "Trigger" collider]
| + | |
− | | + | |
− | thisObject = Space.Host.ExecutingObject
| + | |
− | thisPlayer = Space.Scene.PlayerAvatar
| + | |
− | | + | |
− | OTS = function(gameObject)
| + | |
− | if gameObject.Avatar ~= nil and thisPlayer == gameObject.Avatar then
| + | |
− | | + | |
− | Space.Network.Chat.JoinVoice("PrivateVoiceZone")
| + | |
− |
| + | |
− | end
| + | |
− | | + | |
− | end
| + | |
− | | + | |
− | OTE = function(gameObject)
| + | |
− | if gameObject.Avatar ~= nil and thisPlayer == gameObject.Avatar then
| + | |
− | | + | |
− | Space.Network.Chat.LeaveVoice("PrivateVoiceZone")
| + | |
− |
| + | |
− | end
| + | |
− |
| + | |
− | end
| + | |
− | | + | |
− | | + | |
− | thisObject.OnTriggerStart(OTS)
| + | |
− | thisObject.OnTriggerExit(OTE)</pre>
| + | |
− | }}
| + | |
− | | + | |
− | | + | |
− | | + | |
− | {{ScriptFunction|void|LeaveVoice|(string channel);|Leave a voice chat channel|5=
| + | |
− | Space.Network.Chat.LeaveVoice("PrivateVoiceZone")|6=<pre>--this script will make the player join a voice channel when entering a trigger collider and leave it when leaving
| + | |
− | --[Requires this object to have a "Trigger" collider]
| + | |
− | | + | |
− | thisObject = Space.Host.ExecutingObject
| + | |
− | thisPlayer = Space.Scene.PlayerAvatar
| + | |
− | | + | |
− | OTS = function(gameObject)
| + | |
− | if gameObject.Avatar ~= nil and thisPlayer == gameObject.Avatar then
| + | |
− | | + | |
− | Space.Network.Chat.JoinVoice("PrivateVoiceZone")
| + | |
− |
| + | |
− | end
| + | |
− | | + | |
− | end
| + | |
− | | + | |
− | OTE = function(gameObject)
| + | |
− | if gameObject.Avatar ~= nil and thisPlayer == gameObject.Avatar then
| + | |
− | | + | |
− | Space.Network.Chat.LeaveVoice("PrivateVoiceZone")
| + | |
− |
| + | |
− | end
| + | |
− |
| + | |
− | end
| + | |
− | | + | |
− | | + | |
− | thisObject.OnTriggerStart(OTS)
| + | |
− | thisObject.OnTriggerExit(OTE)</pre>
| + | |
− | }}
| + | |
− | | + | |
− | | + | |
− | {{ScriptFunction|void|JoinGridVoice|(string channel, int prioroty<nowiki>=</nowiki>5, int spatial<nowiki>=</nowiki> 0);|JoinGridVoice is the same as JoinVoice except with a grid wide parameter. (white-label only)|5=
| + | |
− | Space.Network.Chat.JoinGridVoice("PrivateGridVoiceZone")|6=<pre>--this script will make the player join a Grid voice channel when entering a trigger collider and leave it when leaving
| + | |
− | --[Requires this object to have a "Trigger" collider]
| + | |
− | | + | |
− | thisObject = Space.Host.ExecutingObject
| + | |
− | thisPlayer = Space.Scene.PlayerAvatar
| + | |
− | | + | |
− | OTS = function(gameObject)
| + | |
− | if gameObject.Avatar ~= nil and thisPlayer == gameObject.Avatar then
| + | |
− | | + | |
− | Space.Network.Chat.JoinGridVoice("PrivateGridVoiceZone")
| + | |
− |
| + | |
− | end
| + | |
− | | + | |
− | end
| + | |
− | | + | |
− | OTE = function(gameObject)
| + | |
− | if gameObject.Avatar ~= nil and thisPlayer == gameObject.Avatar then
| + | |
− | | + | |
− | Space.Network.Chat.LeaveVoice("PrivateGridVoiceZone")
| + | |
− |
| + | |
− | end
| + | |
− |
| + | |
− | end
| + | |
− | | + | |
− | | + | |
− | thisObject.OnTriggerStart(OTS)
| + | |
− | thisObject.OnTriggerExit(OTE)</pre>}}
| + | |
− | | + | |
− | | + | |
− | | + | |
− | | + | |
− | | + | |
− | | + | |
− | | + | |
− | {{Scripting Navbox}}
| + | |