> For the complete documentation index, see [llms.txt](https://docs.vildstore.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.vildstore.com/dialog-system/exports.md).

# Exports

## Functions

**`OpenDialog`**

Opens a dialog interaction with a specified NPC or entity, allowing players to select options from a customizable menu.

**Parameters:**

* **`data`**: A table containing the following fields:
  * **`ped`**: The NPC or entity to interact with.
  * **`pedName`**: A string representing the name of the NPC displayed at the top of the dialog.
  * **`info`** *(optional)*: A descriptive text providing additional context or information about the dialog.
  * **`options`**: A table of interaction options. Each option can define an action to take when selected.

**Usage:**

```lua
exports('OpenDialog', OpenDialog)
```

**Example:**

```lua
OpenDialog({ 
    ped = GetClosestPed(5.0), -- The NPC or entity to interact with
    pedName = 'Merchant', -- The name of the NPC
    info = 'Welcome to my shop! What would you like to do?', -- Optional dialog description
    options = { 
        { 
            label = 'Buy Items', -- Text for the interaction option
            onSelect = function() 
                print('You chose to buy items!') 
            end 
        }, 
        { 
            label = 'Sell Items', 
            onSelect = function() 
                print('You chose to sell items!') 
            end 
        }, 
        { 
            label = 'Leave', 
            onSelect = function() 
                print('You left the conversation.') 
            end 
        } 
    } 
})
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.vildstore.com/dialog-system/exports.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
