Skip to content

Get Sansar

Script API

Objective

Where: Client
More page actions

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

Class Namespace Sansar.Simulation Inherits Sansar.Script.InstanceInterface Added in 34.7.0

The Objective is the interface for a user’s Quest Objective

public class Objective : Sansar.Script.InstanceInterface

Members at a glance

KindMembers
PropertiesAgent · Count · Definition · Ready
MethodsGetState · SetState · Subscribe · ToString · Update

Properties

Agent

Added in 34.7.0
public Sansar.Script.SessionId Agent { get; }

The session Id for the user on this quest.

Count

Added in 36.3.0
public int Count { get; set; }

Get the number of objectives collected for this user.

Remarks

Returns -1 if the Objective is not Ready.

Definition

Added in 34.7.0
public ObjectiveDefinition Definition { get; }

The QuestDefinition for this quest.

Ready

Added in 36.7.0
public bool Ready { get; }

If the Objective data is ready.

Remarks

Returns false until the data has been fetched from the quest service. Once it returns true it will always return true.

Methods

GetState

Added in 34.7.0
public ObjectiveState GetState()

The ObjectiveState representing the user’s progress in the quest

Returns: ObjectiveState

SetState

Added in 34.7.0
public void SetState(ObjectiveState state)

Set the state of the objective.

ParameterTypeDescription
stateObjectiveStateThe state to transition to.
Remarks

Some state changes may not be permitted, in these cases OperationCompleteEvent success will be false.

Added in 34.7.0
public void SetState(     ObjectiveState state,     Action<Sansar.Script.OperationCompleteEvent> handler )

Set the state of the objective.

ParameterTypeDescription
stateObjectiveStateThe state to transition to.
handlerAction<Sansar.Script.OperationCompleteEvent>Handler to be called when the event completes.
Remarks

Some state changes may not be permitted, in these cases OperationCompleteEvent success will be false.

Subscribe

Added in 34.7.0
public Sansar.Script.IEventSubscription Subscribe(     ObjectiveState State,     Action<ObjectiveData> callback,     bool persistent )

Subscribes to Objective Events.

ParameterTypeDescription
StateObjectiveStateThe state of the objective
callbackAction<ObjectiveData>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.

ToString

Added in 34.7.0
public override string ToString()

A string representation of this object.

Returns: string — A string representation of this object.

Remarks

The format of this string may change between releases.

Update

Added in 36.7.0
public void Update()

Update the ObjectiveDefinition data.

Remarks

Use in a WaitFor to wait for the data for the QuestDefinition to be ready. Once data is retrieved and Ready is true it will never again be false.

Added in 36.7.0
public void Update(     Action<Sansar.Script.OperationCompleteEvent> handler )

Update the ObjectiveDefinition data.

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

Use in a WaitFor to wait for the data for the QuestDefinition to be ready. Once data is retrieved and Ready is true it will never again be false.

Used in examples

Generated from the Sansar 47.10.0 client ScriptApi snapshot.