Chat

Chat Class

The Chat class handles chat subscriptions and sending messages to users and other scripts.

Syntax

[Sansar.Script.Interface]
public class Chat : Sansar.Script.InstanceInterface

Remarks

 

Requirements

Namespace: Sansar.Simulation
Assembly: Sansar.Simulation (in Sansar.Simulation.dll)
Assembly Versions: 1.1.0.0

Members

See Also: Inherited members from Sansar.Script.InstanceInterface.

Public Fields

static readonly
AllChannels int . Use as the channel argument for Chat.Subscribe(int, string, Action<Sansar.Simulation.ChatData>,System.Boolean) to subscribe to all channels.
static readonly
Script string . Indicates that the chat message originated from a script.
static readonly
Server string . Indicates that the chat message originated from the server.
static readonly
User string . Indicates that the chat message originated from a user.

Public Properties

[read-only]
 
IsValid bool . Whether or not this interface is valid. (Inherited from Sansar.Script.InstanceInterface.)

Public Methods

 
MessageAllUsers (string)
Send a chat message to every user in the Experience.
 
MessageScript (string, Sansar.Script.ScriptId, int)
Send a string message to a specific script.
 
Subscribe (int, string, Action<ChatData>, bool)
Subscribes to Chat Events.
 
Subscribe (int, string, Sansar.Script.ScriptId, Action<ChatData>, bool)
Subscribes to Chat Events.
 
Subscribe (int, string, Sansar.Script.SessionId, Action<ChatData>, bool)
Subscribes to Chat Events.
 
Subscribe (int, string, Sansar.Script.SessionId, Sansar.Script.ScriptId, Chat.SubscriptionHandler, bool)
Subscribes to Chat Events.
 
Subscribe (int, string, Sansar.Script.SessionId, Sansar.Script.ScriptId, Action<ChatData>, bool)
Subscribes to Chat Events.

Member Details

AllChannels Field

Use as the channel argument for Chat.Subscribe(int, string, Action<Sansar.Simulation.ChatData>,System.Boolean) to subscribe to all channels.

Syntax

public static readonly int AllChannels

Remarks

 

Requirements

Namespace: Sansar.Simulation
Assembly: Sansar.Simulation (in Sansar.Simulation.dll)
Assembly Versions: 1.1.0.0

MessageAllUsers Method

Send a chat message to every user in the Experience.

Syntax

[Sansar.Script.Interface]
public void MessageAllUsers (string message)

Parameters

message
The message to send.

Remarks

Messages may be throttled.

Requirements

Namespace: Sansar.Simulation
Assembly: Sansar.Simulation (in Sansar.Simulation.dll)
Assembly Versions: 1.1.0.0

MessageScript Method

Send a string message to a specific script.

Syntax

[Sansar.Script.Interface]
public void MessageScript (string message, Sansar.Script.ScriptId scriptId, int channel)

Parameters

message
The message to send.
scriptId
The id of the script to send the message to.
channel
The channel to send the message on.

Remarks

Only the script with the matching id will receive the message.

Requirements

Namespace: Sansar.Simulation
Assembly: Sansar.Simulation (in Sansar.Simulation.dll)
Assembly Versions: 1.1.0.0

Script Field

Indicates that the chat message originated from a script.

Syntax

public static readonly string Script

Remarks

 

Requirements

Namespace: Sansar.Simulation
Assembly: Sansar.Simulation (in Sansar.Simulation.dll)
Assembly Versions: 1.1.0.0

Server Field

Indicates that the chat message originated from the server.

Syntax

public static readonly string Server

Remarks

 

Requirements

Namespace: Sansar.Simulation
Assembly: Sansar.Simulation (in Sansar.Simulation.dll)
Assembly Versions: 1.1.0.0

Subscribe Method

Subscribes to Chat Events.

Syntax

[Sansar.Script.Interface]
public void Subscribe (int Channel, string Source, Action<ChatData> callback, bool persistent)

Parameters

Channel
int channel which the chat occurs on.
Source
string source of the chat: system, user or script.
callback
Callback which is executed when the event completes.
persistent
Optional, set to false to unsubscribe after one event.

Remarks

 

Requirements

Namespace: Sansar.Simulation
Assembly: Sansar.Simulation (in Sansar.Simulation.dll)
Assembly Versions: 1.1.0.0

Subscribe Method

Subscribes to Chat Events.

Syntax

[Sansar.Script.Interface]
public void Subscribe (int Channel, string Source, Sansar.Script.ScriptId SourceScriptId, Action<ChatData> callback, bool persistent)

Parameters

Channel
int channel which the chat occurs on.
Source
string source of the chat: system, user or script.
SourceScriptId
Sansar.Script.ScriptId id of the chat source. May be Sansar.Script.ScriptId.Invalid if the source is not a script.
callback
Callback which is executed when the event completes.
persistent
Optional, set to false to unsubscribe after one event.

Remarks

 

Requirements

Namespace: Sansar.Simulation
Assembly: Sansar.Simulation (in Sansar.Simulation.dll)
Assembly Versions: 1.1.0.0

Subscribe Method

Subscribes to Chat Events.

Syntax

[Sansar.Script.Interface]
public void Subscribe (int Channel, string Source, Sansar.Script.SessionId SourceId, Action<ChatData> callback, bool persistent)

Parameters

Channel
int channel which the chat occurs on.
Source
string source of the chat: system, user or script.
SourceId
Sansar.Script.SessionId id of the chat source. May be Sansar.Script.SessionId.Invalid if the source is not an agent.
callback
Callback which is executed when the event completes.
persistent
Optional, set to false to unsubscribe after one event.

Remarks

 

Requirements

Namespace: Sansar.Simulation
Assembly: Sansar.Simulation (in Sansar.Simulation.dll)
Assembly Versions: 1.1.0.0

Subscribe Method

Subscribes to Chat Events.

Syntax

[Sansar.Script.Interface]
[System.Obsolete("Use subscription callbacks of type Action<Sansar.Simulation.ChatData>", false)]
public void Subscribe (int Channel, string Source, Sansar.Script.SessionId SourceId, Sansar.Script.ScriptId SourceScriptId, Chat.SubscriptionHandler callback, bool persistent)

Parameters

Channel
int channel which the chat occurs on.
Source
string source of the chat: system, user or script.
SourceId
Sansar.Script.SessionId id of the chat source. May be Sansar.Script.SessionId.Invalid if the source is not an agent.
SourceScriptId
Sansar.Script.ScriptId id of the chat source. May be Sansar.Script.ScriptId.Invalid if the source is not a script.
callback
Callback which is executed when the event completes.
persistent
Optional, set to false to unsubscribe after one event.

Remarks

 

Requirements

Namespace: Sansar.Simulation
Assembly: Sansar.Simulation (in Sansar.Simulation.dll)
Assembly Versions: 1.1.0.0

Subscribe Method

Subscribes to Chat Events.

Syntax

[Sansar.Script.Interface]
public void Subscribe (int Channel, string Source, Sansar.Script.SessionId SourceId, Sansar.Script.ScriptId SourceScriptId, Action<ChatData> callback, bool persistent)

Parameters

Channel
int channel which the chat occurs on.
Source
string source of the chat: system, user or script.
SourceId
Sansar.Script.SessionId id of the chat source. May be Sansar.Script.SessionId.Invalid if the source is not an agent.
SourceScriptId
Sansar.Script.ScriptId id of the chat source. May be Sansar.Script.ScriptId.Invalid if the source is not a script.
callback
Callback which is executed when the event completes.
persistent
Optional, set to false to unsubscribe after one event.

Remarks

 

Requirements

Namespace: Sansar.Simulation
Assembly: Sansar.Simulation (in Sansar.Simulation.dll)
Assembly Versions: 1.1.0.0

User Field

Indicates that the chat message originated from a user.

Syntax

public static readonly string User

Remarks

 

Requirements

Namespace: Sansar.Simulation
Assembly: Sansar.Simulation (in Sansar.Simulation.dll)
Assembly Versions: 1.1.0.0


Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

0 Comments

Article is closed for comments.