> ## Documentation Index
> Fetch the complete documentation index at: https://runelite.zip/llms.txt
> Use this file to discover all available pages before exploring further.

# Quests

> Quest state gates, Quest Helper integration, and the Quest Script Manager recorder and player.

Quest support has two layers: `QuestActions` for lightweight state gating, and the Quest Script Manager plugin for recording and replaying action sequences. The [progress APIs](/guides/events-data#progress-reads) cover richer requirement and diary reads.

## Quest actions

`QuestActions` provides read-only quest state checks. All methods are static, never write to the client, and are safe to run off the client thread. When the player is logged out or unavailable they return a `NOT_STARTED` state instead of throwing.

| Method                    | Returns                                     |
| ------------------------- | ------------------------------------------- |
| `getState(Quest quest)`   | `FINISHED`, `IN_PROGRESS`, or `NOT_STARTED` |
| `isStarted(Quest quest)`  | True when `IN_PROGRESS` or `FINISHED`       |
| `isComplete(Quest quest)` | True when `FINISHED`                        |

```java theme={null}
if (!QuestActions.isComplete(Quest.DRAGON_SLAYER_I)) {
    log.warn("Dragon Slayer I is required to run this plugin. Stopping.");
    stopPlugin();
    return;
}
```

<Warning>
  RuneLite populates its local quest cache on login. During login transitions and loading screens, `getState` can temporarily read `NOT_STARTED`. Gate on your plugin's own readiness checks before treating a quest as incomplete.
</Warning>

## Quest Helper integration

Shared consumers use `QuestHelperSnapshotReader` to reflect against the player's installed official Quest Helper plugin and expose a flattened snapshot of its currently selected step. Questing Assistant and other snapshot consumers therefore depend on an installed, compatible official Quest Helper plugin for live state.

## Quest Script Manager

Quest Script Manager (`questscriptmanager` config group, disabled by default) records selected player actions into an in-memory sequential script and plays supported steps back through the n3 interaction APIs.

<Tip>
  Treat recordings as linear drafts, not complete quest definitions. The model has no stage or branch nodes; playback advances through the recorded list and never selects a branch from quest state.
</Tip>

### Step model

`QuestScript` stores metadata, one `QuestScriptConfig`, and an ordered list of steps. Six concrete step types exist:

| Step                 | Action                                                                            | Boundary                                                 |
| -------------------- | --------------------------------------------------------------------------------- | -------------------------------------------------------- |
| `TalkToNpcStep`      | Interact with a primary or alternate NPC ID                                       | No conditional NPC-state transitions                     |
| `InteractObjectStep` | Interact with a primary or alternate object ID, optionally near an exact location | No arbitrary widgets or simulated objects                |
| `UseItemStep`        | Inventory action or item on NPC/object/item/ground item                           | Target discovery and postconditions stay with the author |
| `DialogueStep`       | Continue or select a numbered option                                              | No patterns, exclusions, or varbit-dependent choices     |
| `WalkStep`           | Walk to a destination, optionally through waypoints                               | Arrival is not proof the quest stage advanced            |
| `WaitStep`           | Wait fixed ticks or for one condition                                             | A wait is not a replayable generic UI operation          |

Every step can store descriptions, preconditions, postconditions, required and acquired items, priority, and estimated ticks.

### Conditions

`QuestConditionFactory` builds preconditions and postconditions in Java: item quantity in inventory or inventory-plus-bank, distance from a `WorldPoint`, named quest state, varbit equality or minimum, nearby NPC or object by ID and radius, widget visibility, dialogue text containment, plus composite AND/OR and logical NOT. Attach them through the step builders. The panel has no condition editor.

### Recording

The recorder listens to menu, dialogue, movement, and game-tick events and produces the step types above: NPC and object menu actions, inventory and item-on-target actions, dialogue continues and selections, and movement beyond the configured threshold. Actions buffer and flush periodically. The recorder does not infer alternate transformed IDs, quest stages, conditional branches, eligibility requirements, or item-acquisition policy; unknown widget actions record as a one-tick wait with descriptive text. The panel offers record, pause/resume, stop, undo, and add-wait controls.

### Playback

`QuestScriptPlayer` requests the shared input lock on start and releases it on pause, stop, reset, failure, and completion. Each running tick:

1. checks the global tick limit;
2. waits for the shared pacer when pacing is enabled;
3. selects the current sequential step and checks its preconditions;
4. executes the step;
5. checks postconditions after a successful result (respecting the `verifyPostconditions` config field);
6. advances, retries, skips, or fails per the player configuration.

`DISPATCHED` means the action was accepted for dispatch; the player revisits the step and re-checks postconditions rather than treating dispatch as completion. Script completion means the sequential list was exhausted, not that the named quest reached a state.

### Configuration

Two configuration objects exist and they are not the same:

* **`QuestScriptManagerConfig`** (active plugin config) controls pacing, retries, recording options, movement threshold, auto-stop, and logging.
* **`QuestScriptConfig`** (stored per-script) holds acquisition, banking, teleport use, failure policy, timeouts, and similar fields. The current playback path does not read these fields; they are metadata.

### Construction, storage, and import

Build scripts in Java with the step builders:

```java theme={null}
QuestScript script = QuestScript.builder(
        "cooks_assistant_draft",
        "Cook's Assistant draft",
        "Cook's Assistant")
    .addStep(WalkStep.builder()
        .destination(new WorldPoint(3210, 3212, 0))
        .maxDistance(3)
        .build())
    .addStep(TalkToNpcStep.builder()
        .npcId(1234)
        .npcName("Cook")
        .action("Talk-to")
        .addPrecondition(QuestConditionFactory.npcNearby(1234, 8))
        .addPostcondition(QuestConditionFactory.dialogueContains("ingredients"))
        .build())
    .build();
```

The panel can export a selected script as Gson JSON and import a JSON file. Treat exported files as authoring output: the current import path has no type discriminators, so a meaningful polymorphic round trip is not supported.

<Warning>
  Define a real postcondition for every consequential step and require the actual quest or stage postcondition. Do not count a dispatched action, a finished list, or a passed test as quest completion. Confirm revision-sensitive IDs against current gameval constants before live use.
</Warning>
