SimpleScript.OnChatOptionsAttribute

SimpleScript.OnChatOptionsAttribute Class

Set options for OnChat() overrides, or use to create more simple chat handlers.

Syntax

[Sansar.Script.Interface]
[System.AttributeUsage(System.AttributeTargets.Method, AllowMultiple=true)]
[System.Obsolete("SimpleScript is deprecated and will not receive new features. Please use SceneObjectScript or ObjectScript.", false)]
protected class SimpleScript.OnChatOptionsAttribute : SimpleScript.SimpleScriptOptionsAttribute

See Also

Remarks

This attribute is optional when overriding OnChat which by default will respond to all chat on the default channel (Chat.DefaultChannel) and all sources.

Add this attribute to any method that matches Action<ChatData> to create extra chat event subscriptions.
C# Example
            [OnChatOptions(Channel=5)]
            void ChatFrom5(ChatData data)
            {
               // chat from channel 5.
            }
              
            void OnChat(ChatData data)
            {
               // chat from the default channel (0)
            }

Example

C# Example
            // Only listen for chat on Channel 10 from scripts.
            [OnChatOptions(Channel=10, Source="script")]
            protected override OnChat(ChatData data)
            

Requirements

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

Members

See Also: Inherited members from SimpleScript.SimpleScriptOptionsAttribute.

Public Constructors

 
Set options for OnChat events

Public Properties

 
Channel int . Specify a specific channel to listen for messages on.
 
Source string . string source of the chat: system, user or script.

Member Details

SimpleScript.OnChatOptionsAttribute Constructor

Set options for OnChat events

Syntax

public SimpleScript.OnChatOptionsAttribute ()

Remarks

 

Requirements

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

Channel Property

Specify a specific channel to listen for messages on.

Syntax

[Sansar.Script.Interface]
[System.Obsolete("SimpleScript is deprecated and will not receive new features. Please use SceneObjectScript or ObjectScript.", false)]
public int Channel { get; set; }

Value

The channel to listen for chat on.

Remarks

By default listens for chat on Chat.DefaultChannel (0).

Example

C# Example
            // Only listen for chat on Channel 10.
            [OnChatOptions(Channel=10)]
            protected override OnChat(ChatData data)
            

Requirements

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

Source Property

string source of the chat: system, user or script.

Syntax

[Sansar.Script.Interface]
[System.Obsolete("SimpleScript is deprecated and will not receive new features. Please use SceneObjectScript or ObjectScript.", false)]
public string Source { get; set; }

Value

The source chat to listen for: "script", "user" or "system"

Remarks

Restricts which chat messages will trigger OnChat. [OnChatOptions(Source="user")] will only run OnChat for chat from users, while "script" will respond to other script messages, and "system" will only respond to system messages.

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.