# TLO:NearestSpawn

## Description

Object that is used in finding spawns nearest to you.

## Forms

|                                                                                                                      |                                                                                                                         |
| -------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| [*spawn*](/macroquest/data-types-and-top-level-objects/data-types/datatype-spawn.md) **NearestSpawn\[**#**]**        | The #th nearest spawn                                                                                                   |
| [*spawn*](/macroquest/data-types-and-top-level-objects/data-types/datatype-spawn.md) **NearestSpawn\[search]**       | The nearest spawn matching this search string (see [Spawn Search](/macroquest/general-information/spawn-search.md))     |
| [*spawn*](/macroquest/data-types-and-top-level-objects/data-types/datatype-spawn.md) **NearestSpawn\[**#**,search]** | The #th nearest spawn matching this search string (see [Spawn Search](/macroquest/general-information/spawn-search.md)) |

## Access to Types

* [*spawn*](/macroquest/data-types-and-top-level-objects/data-types/datatype-spawn.md) **spawn**

## Examples

`/echo ${NearestSpawn[npc radius 100 "orc pawn"]}`

Finds the npc containing orc pawn in its name that is within 100 of you.

`/echo ${NearestSpawn[2]}`

Finds the closest spawn to you (${NearestSpawn\[1]} will always match yourself).

## See Also

* [Top-Level Objects](/macroquest/data-types-and-top-level-objects/top-level-objects.md)
* [spawn](/macroquest/data-types-and-top-level-objects/data-types/datatype-spawn.md)
* [Spawn Search](/macroquest/general-information/spawn-search.md)


---

# 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/top-level-objects/tlo-nearestspawn.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.
