# DataType:merchant

This contains information related to the active merchant.

## Members

This type inherits members from [*spawn*](/macroquest/data-types-and-top-level-objects/data-types/datatype-spawn.md) if a merchant is active.

| **Type**                                                                                                     | **Member**                    | **Description**                                                                                                                                                                                                                                                                  |
| ------------------------------------------------------------------------------------------------------------ | ----------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [*bool*](/macroquest/data-types-and-top-level-objects/data-types/datatype-bool.md)                           | **Full**                      | Returns TRUE if the merchant's inventory is full                                                                                                                                                                                                                                 |
| [*int*](/macroquest/data-types-and-top-level-objects/data-types/datatype-int.md)                             | **Items**                     | Number of items on the merchant                                                                                                                                                                                                                                                  |
| [*item*](/macroquest/data-types-and-top-level-objects/data-types/datatype-item.md)                           | **Item\[**#**]**              | Item number # on the merchant's list                                                                                                                                                                                                                                             |
| [*item*](/macroquest/data-types-and-top-level-objects/data-types/datatype-item.md)                           | **Item\[**&#x6E;am&#x65;**]** | Finds an item by partial name on the merchant (use **merchant.Item\[**=nam&#x65;**]** for exact)                                                                                                                                                                                 |
| [*float*](/macroquest/data-types-and-top-level-objects/data-types/datatype-float.md)                         | **Markup**                    | <p>The number used to calculate the buy and sell value for an item (this is what is changed by charisma and faction). This value is capped at 1.05<br></p><ul><li>Markup*Item Value = Amount you buy item for</li><li>Item Value*(1/Markup) = Amount you sell item for</li></ul> |
| [*bool*](/macroquest/data-types-and-top-level-objects/data-types/datatype-bool.md)                           | **Open**                      | Returns TRUE if merchant is open                                                                                                                                                                                                                                                 |
| [*item*](/macroquest/data-types-and-top-level-objects/data-types/datatype-item.md)                           | **SelectedItem**              | The currently selected item in the merchant window, and item type                                                                                                                                                                                                                |
| [*bool*](/macroquest/data-types-and-top-level-objects/data-types/datatype-bool.md)                           | **ItemsReceived**             | True if the merchants itemlist has been filled in.                                                                                                                                                                                                                               |
| \<em>\</em>[*string*](/macroquest/data-types-and-top-level-objects/data-types/datatype-string.md)\<em>\</em> | **To String**                 | Same as **Open**                                                                                                                                                                                                                                                                 |

## Methods

| Name                 | Action                                                                                                               |
| -------------------- | -------------------------------------------------------------------------------------------------------------------- |
| **Buy\[#]**          | Buys # of whatever is selected with **Merchant.SelectItem\[xxx]**                                                    |
| **OpenWindow**       | Will open the merchant closest to you, or if you have a merchant target                                              |
| **SelectItem\[xxx]** | Select item specified or partial match that fits. Use **SelectItem\[=xxx]** for EXACT match (its not case sensitive) |
| **Sell\[#]**         | Sell # of whatever is selected with /selectitem. See examples                                                        |

## Examples

Using `${Merchant.Sell[#]}`

`/selectitem "Diamond"`

Will select a "Diamond" you can also do "=Diamond" to match EXACT name (its not case sensitive though)

Then you can use

`/invoke ${Merchant.Sell[100]}`

Sells 100 of whatever is selected with /selectitem


---

# Agent Instructions: 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:

```
GET https://macroquest.gitbook.io/macroquest/data-types-and-top-level-objects/data-types/datatype-merchant.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
