Skip to content

Get Sansar

Script API

Interaction

Where: Client
More page actions

For the complete documentation index, see llms.txt. This page is also available as Markdown.

public class Interaction : Sansar.Script.InstanceInterface

Members at a glance

KindMembers
MethodsGetEnabled · GetPrompt · SetEnabled · SetPrompt · Subscribe

Methods

GetEnabled

public bool GetEnabled()

Returns true if the interaction is enabled.

Returns: bool — true if the interaction is enabled.

Remarks

Disabled interactions do not highlight, do not show their prompt and cannot be ‘clicked’.

GetPrompt

public string GetPrompt()

Get the current Interaction prompt.

Returns: string — The current prompt string.

Remarks

The prompt text shows when hovering over the object the script is on.

SetEnabled

public void SetEnabled(bool value)

Change an Interaction state to disabled or enabled.

ParameterTypeDescription
valuebooltrue to enable the Interaction, false to disable it.
Remarks

All Interactions start off enabled. Disabled interactions do not highlight, do not show their prompt and cannot be ‘clicked’.

public void SetEnabled(Sansar.Script.SessionId sessionId, bool value)

Change an Interaction state to disabled or enabled.

ParameterTypeDescription
sessionIdSansar.Script.SessionIdThe SessionId of the agent to disable or enable the interaction for..
valuebooltrue to enable the Interaction, false to disable it.
Remarks

All Interactions start off enabled. Disabled interactions do not highlight, do not show their prompt and cannot be ‘clicked’. This method will only change the enabled state for a single user and will not persist across client restarts, server restarts, or leaving the scene (even for changing avatars). It will also be overriden by any global setEnabled calls.

public void SetEnabled(AgentPrivate agent, bool value)

Change an Interaction state to disabled or enabled.

ParameterTypeDescription
agentAgentPrivateThe agent to disable or enable the interaction for.
valuebooltrue to enable the Interaction, false to disable it.
Remarks

All Interactions start off enabled. Disabled interactions do not highlight, do not show their prompt and cannot be ‘clicked’. This method will only change the enabled state for a single user and will not persist across client restarts, server restarts, or leaving the scene (even for changing avatars). It will also be overriden by any global setEnabled calls.

Deprecated
[System.Obsolete("Deprecated. Use the Action<> overload", false)] public ulong SetEnabled(     bool value,     Sansar.Script.ScriptBase.OperationComplete handler )

Change an Interaction state to disabled or enabled.

ParameterTypeDescription
valuebooltrue to enable the Interaction, false to disable it.
handlerSansar.Script.ScriptBase.OperationCompleteHandler to be called when the event completes.

Returns: ulong — A legacy eventId

Remarks

All Interactions start off enabled. Disabled interactions do not highlight, do not show their prompt and cannot be ‘clicked’.

public void SetEnabled(     bool value,     Action<Sansar.Script.OperationCompleteEvent> handler )

Change an Interaction state to disabled or enabled.

ParameterTypeDescription
valuebooltrue to enable the Interaction, false to disable it.
handlerAction<Sansar.Script.OperationCompleteEvent>Handler to be called when the event completes.
Remarks

All Interactions start off enabled. Disabled interactions do not highlight, do not show their prompt and cannot be ‘clicked’.

public void SetEnabled(     Sansar.Script.SessionId sessionId,     bool value,     Action<Sansar.Script.OperationCompleteEvent> handler )

Change an Interaction state to disabled or enabled.

ParameterTypeDescription
sessionIdSansar.Script.SessionIdThe SessionId of the agent to disable or enable the interaction for..
valuebooltrue to enable the Interaction, false to disable it.
handlerAction<Sansar.Script.OperationCompleteEvent>Handler to be called when the event completes.
Remarks

All Interactions start off enabled. Disabled interactions do not highlight, do not show their prompt and cannot be ‘clicked’. This method will only change the enabled state for a single user and will not persist across client restarts, server restarts, or leaving the scene (even for changing avatars). It will also be overriden by any global setEnabled calls.

public void SetEnabled(     AgentPrivate agent,     bool value,     Action<Sansar.Script.OperationCompleteEvent> handler )

Change an Interaction state to disabled or enabled.

ParameterTypeDescription
agentAgentPrivateThe agent to disable or enable the interaction for.
valuebooltrue to enable the Interaction, false to disable it.
handlerAction<Sansar.Script.OperationCompleteEvent>Handler to be called when the event completes.
Remarks

All Interactions start off enabled. Disabled interactions do not highlight, do not show their prompt and cannot be ‘clicked’. This method will only change the enabled state for a single user and will not persist across client restarts, server restarts, or leaving the scene (even for changing avatars). It will also be overriden by any global setEnabled calls.

SetPrompt

public void SetPrompt(string prompt)

Set the Interaction prompt string.

ParameterTypeDescription
promptstringThe string to set the prompt to.
Remarks

The prompt text shows when hovering over the object the script is on. The prompt must be 128 characters or less and 4 lines or less. Use DefaultValueAttribute to set a default prompt.

public void SetPrompt(     Sansar.Script.SessionId sessionId,     string prompt )

Set the Interaction prompt string.

ParameterTypeDescription
sessionIdSansar.Script.SessionIdThe sessionId of the user to change the prompt for.
promptstringThe string to set the prompt to.
Remarks

The prompt text shows when hovering over the object the script is on. The prompt must be 128 characters or less and 4 lines or less. Will only change the prompt for a single user and will not persist across client restarts, server restarts, or leaving the scene (even for changing avatars). It will also be overriden by any global setPrompt calls.

public void SetPrompt(AgentPrivate agent, string prompt)

Set the Interaction prompt string.

ParameterTypeDescription
agentAgentPrivateThe agent to change the prompt for.
promptstringThe string to set the prompt to.
Remarks

The prompt text shows when hovering over the object the script is on. The prompt must be 128 characters or less and 4 lines or less. Will only change the prompt for a single user and will not persist across client restarts, server restarts, or leaving the scene (even for changing avatars). It will also be overriden by any global setPrompt calls.

Deprecated
[System.Obsolete("Deprecated. Use the Action<> overload", false)] public ulong SetPrompt(     string prompt,     Sansar.Script.ScriptBase.OperationComplete handler )

Set the Interaction prompt string.

ParameterTypeDescription
promptstringThe string to set the prompt to.
handlerSansar.Script.ScriptBase.OperationCompleteHandler to be called when the event completes.

Returns: ulong — A legacy eventId

Remarks

The prompt text shows when hovering over the object the script is on. The prompt must be 128 characters or less and 4 lines or less. Use DefaultValueAttribute to set a default prompt.

public void SetPrompt(     string prompt,     Action<Sansar.Script.OperationCompleteEvent> handler )

Set the Interaction prompt string.

ParameterTypeDescription
promptstringThe string to set the prompt to.
handlerAction<Sansar.Script.OperationCompleteEvent>Handler to be called when the event completes.
Remarks

The prompt text shows when hovering over the object the script is on. The prompt must be 128 characters or less and 4 lines or less. Use DefaultValueAttribute to set a default prompt.

public void SetPrompt(     Sansar.Script.SessionId sessionId,     string prompt,     Action<Sansar.Script.OperationCompleteEvent> handler )

Set the Interaction prompt string.

ParameterTypeDescription
sessionIdSansar.Script.SessionIdThe sessionId of the user to change the prompt for.
promptstringThe string to set the prompt to.
handlerAction<Sansar.Script.OperationCompleteEvent>Handler to be called when the event completes.
Remarks

The prompt text shows when hovering over the object the script is on. The prompt must be 128 characters or less and 4 lines or less. Will only change the prompt for a single user and will not persist across client restarts, server restarts, or leaving the scene (even for changing avatars). It will also be overriden by any global setPrompt calls.

public void SetPrompt(     AgentPrivate agent,     string prompt,     Action<Sansar.Script.OperationCompleteEvent> handler )

Set the Interaction prompt string.

ParameterTypeDescription
agentAgentPrivateThe agent to change the prompt for.
promptstringThe string to set the prompt to.
handlerAction<Sansar.Script.OperationCompleteEvent>Handler to be called when the event completes.
Remarks

The prompt text shows when hovering over the object the script is on. The prompt must be 128 characters or less and 4 lines or less. Will only change the prompt for a single user and will not persist across client restarts, server restarts, or leaving the scene (even for changing avatars). It will also be overriden by any global setPrompt calls.

Subscribe

public Sansar.Script.IEventSubscription Subscribe(     Action<InteractionData> callback,     bool persistent )

Subscribes to Interaction Events.

ParameterTypeDescription
callbackAction<InteractionData>Callback which is executed when the event completes.
persistentboolOptional, set to false to unsubscribe after one event.

Returns: Sansar.Script.IEventSubscription — An IEventSubscription that can be used to cancel the subscription.

Used in examples

…and 1 more examples in the snapshot.

Generated from the Sansar 47.10.0 client ScriptApi snapshot.