Join a chat channel.
--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)
Leave a chat channel.
--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)
Bind a function to the OnChat event. This function will be called every time a new chat message is received on the local channel.
Space.Network.Chat.OnChat(OnChatFunction)
--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)
Get XMPP name.
Join a chat channel.
|