> For the complete documentation index, see [llms.txt](https://fehdead.gitbook.io/npc-kit/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://fehdead.gitbook.io/npc-kit/vm-reference/calls/getquestscenarioflag.md).

# npc.getquestscenarioflag

```lua
npc.getquestscenarioflag(quest)
```

|                         |                                                                                     |
| ----------------------- | ----------------------------------------------------------------------------------- |
| id                      | `0x02B4`                                                                            |
| arguments               | 1: Int                                                                              |
| result                  | int: goes to the very next call, or to `npc.lua(npc.getquestscenarioflag(...), fn)` |
| in NPC Kit              | yes                                                                                 |
| measured from a kit NPC | returns                                                                             |
| vanilla scripts         | 440 calls in 82 of 1114 scripts                                                     |

## What it does

Gives the progress value of one of the game's quests. A result.

## Arguments

### `quest` (Int)

The quest, 0 to 255; a number out of range reads 0 or 255. The hunts are 128 to 172.

## Result

The value, 0 to 255.

## Timing

Returns at once.

## In NPC Kit

Reading is safe: `npc.lua(npc.getquestscenarioflag(q), fn)`. Apart from the hunts (128 to 172), which quest is which has no bundled table: ask the requester.

## Used with

* [isquestclear](https://fehdead.gitbook.io/npc-kit/vm-reference/calls/isquestclear.md).

## Example

An NPC whose line follows a quest's progress. The quest number and the values are the requester's: there is no bundled table.

```lua
local rumour = [[
Haven't you heard? Something stirs in the sands,
and the caravans won't cross the desert anymore.
]]

local goodLuck = [[
So you've taken the job, then. Good luck to you,
you'll need every bit of it out in those dunes.
]]

local quest = 0   -- ask the requester which quest

talk = function()
    talkOpen();
    npc.lua(npc.getquestscenarioflag(quest), function(handle, step)
        if step == 0 then
            say(handle, rumour)
        else
            say(handle, goodLuck)
        end
    end);
    talkClose();
end,
```

## Pitfalls

* Read only: writing it is [setquestscenarioflag](https://fehdead.gitbook.io/npc-kit/vm-reference/calls/setquestscenarioflag.md), which a mod shouldn't do.
