wiki.sine.space | sinespace

Difference between revisions of "Scripting/SChatMessage"

From wiki.sine.space
Jump to: navigation, search
(Creaated SChatMessage + defined all members + added simple examples)
 
Line 1: Line 1:
 
==Public Attributes==
 
==Public Attributes==
 +
 +
 +
 
{{ScriptFunction|string|Channel|{}|Name of the channel|5=<pre>function oc(chatm)
 
{{ScriptFunction|string|Channel|{}|Name of the channel|5=<pre>function oc(chatm)
 
   Space.Log(chatm.Channel)
 
   Space.Log(chatm.Channel)
 
end
 
end
Space.Network.Chat.OnChat(oc)</pre>}}
+
Space.Network.Chat.OnChat(oc)</pre>|6=<pre>--this script processes every new chat message and makes a UIText display the channel's name
 +
uiText = Space.Host.GetReference("text").UIText --Add this Text object as reference in Scripting Runtime
 +
 
 +
OnChatFunction = function(SChatMessage)
 +
uiText.Text = SChatMessage.Channel
 +
end
 +
 
 +
Space.Network.Chat.OnChat(OnChatFunction) </pre>}}
 +
 
 +
 
 +
 
 
{{ScriptFunction|string|Message|{}|The contents of the chat message|5=<pre>function oc(chatm)
 
{{ScriptFunction|string|Message|{}|The contents of the chat message|5=<pre>function oc(chatm)
 
   Space.Log(chatm.Message)
 
   Space.Log(chatm.Message)
 
end
 
end
Space.Network.Chat.OnChat(oc)</pre>}}
+
Space.Network.Chat.OnChat(oc)</pre>|6=<pre>--this script processes every new chat message and makes a UIText display the Message
 +
uiText = Space.Host.GetReference("text").UIText --Add this Text object as reference in Scripting Runtime
 +
 
 +
OnChatFunction = function(SChatMessage)
 +
uiText.Text = SChatMessage.Message
 +
end
 +
 
 +
Space.Network.Chat.OnChat(OnChatFunction) </pre>}}
 +
 
 +
 
 +
 
 
{{ScriptFunction|string|Sender|{}|Name of the sender of the message|5=<pre>function oc(chatm)
 
{{ScriptFunction|string|Sender|{}|Name of the sender of the message|5=<pre>function oc(chatm)
 
   Space.Log(chatm.Sender)
 
   Space.Log(chatm.Sender)
 
end
 
end
Space.Network.Chat.OnChat(oc)</pre>}}
+
Space.Network.Chat.OnChat(oc)</pre>|6=<pre>--this script processes every new chat message and makes a UIText display the Sender name
 +
uiText = Space.Host.GetReference("text").UIText --Add this Text object as reference in Scripting Runtime
 +
 
 +
OnChatFunction = function(SChatMessage)
 +
uiText.Text = SChatMessage.Sender
 +
end
 +
 
 +
Space.Network.Chat.OnChat(OnChatFunction) </pre>}}
 +
 
 +
 
 +
 
 
{{ScriptFunction|uint|SenderID|{}|ID of the sender of the message|5=<pre>function oc(chatm)
 
{{ScriptFunction|uint|SenderID|{}|ID of the sender of the message|5=<pre>function oc(chatm)
 
   Space.Log(chatm.SenderID)
 
   Space.Log(chatm.SenderID)
 
end
 
end
Space.Network.Chat.OnChat(oc)</pre>}}
+
Space.Network.Chat.OnChat(OnChatFunction)</pre> |6=<pre>--this script processes every new chat message and makes a UIText display the Sender's ID
 +
uiText = Space.Host.GetReference("text").UIText --Add this Text object as reference in Scripting Runtime
 +
 
 +
OnChatFunction = function(SChatMessage)
 +
uiText.Text = SChatMessage.SenderID
 +
end
 +
 
 +
Space.Network.Chat.OnChat(OnChatFunction) </pre> }}
 +
 
 +
 
  
  

Revision as of 11:59, 4 January 2022

Public Attributes

Channel

string Channel {}

Name of the channel

function oc(chatm)
  Space.Log(chatm.Channel)
end
Space.Network.Chat.OnChat(oc)


--this script processes every new chat message and makes a UIText display the channel's name
uiText = Space.Host.GetReference("text").UIText --Add this Text object as reference in Scripting Runtime

OnChatFunction = function(SChatMessage)
uiText.Text = SChatMessage.Channel
end

Space.Network.Chat.OnChat(OnChatFunction) 


Message

string Message {}

The contents of the chat message

function oc(chatm)
  Space.Log(chatm.Message)
end
Space.Network.Chat.OnChat(oc)


--this script processes every new chat message and makes a UIText display the Message 
uiText = Space.Host.GetReference("text").UIText --Add this Text object as reference in Scripting Runtime

OnChatFunction = function(SChatMessage)
uiText.Text = SChatMessage.Message 
end

Space.Network.Chat.OnChat(OnChatFunction) 


Sender

string Sender {}

Name of the sender of the message

function oc(chatm)
  Space.Log(chatm.Sender)
end
Space.Network.Chat.OnChat(oc)


--this script processes every new chat message and makes a UIText display the Sender name
uiText = Space.Host.GetReference("text").UIText --Add this Text object as reference in Scripting Runtime

OnChatFunction = function(SChatMessage)
uiText.Text = SChatMessage.Sender 
end

Space.Network.Chat.OnChat(OnChatFunction) 


SenderID

uint SenderID {}

ID of the sender of the message

function oc(chatm)
  Space.Log(chatm.SenderID)
end
Space.Network.Chat.OnChat(OnChatFunction)


--this script processes every new chat message and makes a UIText display the Sender's ID
uiText = Space.Host.GetReference("text").UIText --Add this Text object as reference in Scripting Runtime

OnChatFunction = function(SChatMessage)
uiText.Text = SChatMessage.SenderID 
end

Space.Network.Chat.OnChat(OnChatFunction)