Skip to content

Get Sansar

Script API

Quest

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 Quest is the interface for a user’s progress in a Quest.

public class Quest : Sansar.Script.InstanceInterface

Remarks

Each instance of Quest is generated from a QuestDefinition and is associated with a specific user, represented by a SessionId. It can be used to offer the quest to that user, and to track and control their progress through the quest.

Members at a glance

KindMembers
PropertiesAgent · Definition · Objectives · Ready
MethodsGetState · Offer · 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.

Definition

Added in 34.7.0
public QuestDefinition Definition { get; }

The QuestDefinition for this quest.

Objectives

Added in 34.7.0
public Objective[] Objectives { get; }

Returns a list of the objectives for this quest.

Ready

Added in 36.7.0
public bool Ready { get; }

If the Quest 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 QuestState GetState()

The QuestState representing the user’s progress in the quest.

Returns: QuestState

Offer

Added in 34.7.0
public void Offer()

Offer the quest to a user.

Added in 34.7.0
public void Offer(     Action<Sansar.Script.OperationCompleteEvent> handler )

Offer the quest to a user.

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

SetState

Added in 34.7.0
public void SetState(QuestState state)

Set the state of the quest

ParameterTypeDescription
stateQuestStateThe state to transition to.
Added in 34.7.0
public void SetState(     QuestState state,     Action<Sansar.Script.OperationCompleteEvent> handler )

Set the state of the quest

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

Subscribe

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

Subscribes to Quest Events.

ParameterTypeDescription
StateQuestStateThe state of the quest
callbackAction<QuestData>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.