> 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/gillwinopen.md).

# npc.gillwinopen

```lua
npc.gillwinopen(gil)
```

|                         |                                |
| ----------------------- | ------------------------------ |
| id                      | `0x0487`                       |
| arguments               | 1: Int                         |
| in NPC Kit              | yes                            |
| measured from a kit NPC | returns                        |
| vanilla scripts         | 58 calls in 42 of 1114 scripts |

## What it does

Opens the small gil window near the bottom right, just above the dialogue window, showing a gil figure, when none is open.

## Arguments

### `gil` (Int)

The figure shown. Every vanilla call passes `havegill()`.

## Timing

Returns at once; the window stays until [gillwinclose](https://fehdead.gitbook.io/npc-kit/vm-reference/calls/gillwinclose.md).

## In NPC Kit

`npc.gillwinopen(npc.havegill())` in a named function, before the price question; see the gil flow in `references/talks.md`, Reading a value: gil.

## Used with

* [havegill](https://fehdead.gitbook.io/npc-kit/vm-reference/calls/havegill.md), [gillwinstart](https://fehdead.gitbook.io/npc-kit/vm-reference/calls/gillwinstart.md), [gillwinsync](https://fehdead.gitbook.io/npc-kit/vm-reference/calls/gillwinsync.md), [subgill](https://fehdead.gitbook.io/npc-kit/vm-reference/calls/subgill.md), [gillwinclose](https://fehdead.gitbook.io/npc-kit/vm-reference/calls/gillwinclose.md).

## Example

The window opens before the price question and closes on every way out.

```lua
local room = [[
A night's rest at the inn is just 50 gil, friend.
Will you stay with us here tonight, then, or not?
]]

local roomChoices = { "Yes", "No" }

openGil = function()
    npc.gillwinopen(npc.havegill());
end,
closeGil = function()
    npc.gillwinclose();
end,

talk = function()
    talkOpen();
    npc.lua(function(handle)
        handle.run("openGil", function()
            if not dialog.aaske.open {
                    speaker = "NPCKit 0020",
                    body = room,
                    choice = roomChoices,
                    cancel = 1,
                    queue = true,
                    onClose = function(index, reason)
                        local paid = reason == "dismissed" and index == 0
                        handle.run(paid and "pay" or "closeGil", function() handle.finish() end)
                    end,
                    onError = function() handle.run("closeGil", function() handle.finish() end) end
                } then
                handle.run("closeGil", function() handle.finish() end)
            end
        end)
    end);
    talkClose();
end,
```

`pay` is `gillwinstart(-50)`, `gillwinsync()`, `subgill(50)`, `wait(20)`, `gillwinclose()`: the window is already open.

## Pitfalls

* A talk that ends with the window open leaves it on screen: close it in every branch.
