> For the complete documentation index, see [llms.txt](https://wiki.stmod.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wiki.stmod.net/private-servers/levelbot.md).

# Levelbot

<figure><img src="https://1662484209-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSrVu0j9CYXbvJXRYgHnk%2Fuploads%2Fgit-blob-0c8e328d24d03e5f414982536032f4dd89f7124e%2Flevelbot-tab.png?alt=media" alt="Levelbot sub-tab"><figcaption><p>Levelbot (build v131026)</p></figcaption></figure>

The **Levelbot** is a sub-tab of **Farming** that farms a list of map areas one after another.

It is a scheduler sitting on top of the normal farmbot — targeting, pickup, movement and CH changing are all still the existing farmbot. You start the farmbot as usual; the Levelbot only decides *where* it farms.

## Area mode

* **Single Area** — Keeps the bot on one spot.
* **Multiple Areas** — Walks the saved area list: it farms area 1, then moves to area 2, and so on, using the conditions on the right to decide when to move on.

The two are mutually exclusive — ticking one unticks the other. Ticking either one also:

* turns **Farm by route** off, because the route and the area list would both try to steer your character at the same time, and
* switches **Fixed range** and **go to initial position** on, so the bot stays inside the circle it is working in.

{% hint style="info" %}
Only **Multiple Areas** actually cycles through areas. **Single Area** is effectively a preset: it pins the farmbot to the spot you started on and leaves it there. Area cycling also stops if the list is empty or Farm by route gets switched back on.
{% endhint %}

## Building an area list

* **Create new Area** — Saves the spot you are standing on, together with the current farming range. It reads your character position, so it works on clients that have no map window. New areas are always added at the end.
* **Remove last** — Drops the area added most recently.
* **Remove selected** — Drops the one picked in the **Areas** box.

### The Areas box

Lists the areas of the list you are editing, in the order the bot visits them. Each line reads like `1) 436 712 r20`:

* the position in the list,
* the **x** and **y** the area is centred on,
* `r` followed by its range.

A `>` marks the area the bot is working on right now.

{% hint style="info" %}
The numbers shown here are scaled for readability — x and y are the world coordinates divided by 100, and the range is shown in the same units as the farming range field. The saved file stores the raw values instead, so the numbers in the file are much larger than the ones in this box.
{% endhint %}

### Saving, loading and hand-editing

* **Save** — Writes the current areas under the name typed in the box.
* **Load** — Brings a saved list back and makes it the one the bot uses.
* **Notepad** — Opens the selected list in a text editor so you can fine-tune the numbers by hand.
* **(?)** next to the list box — Reloads the names, after you add or delete files yourself.
* **Current Area List** — Shows which list is loaded.

Lists are plain text files in `STMod folder → Data → LevelAreas`, saved as `<name>.txt`, one area per line as `x y range`. The order of the lines is the order the areas are visited, so reordering means editing the file — **Create new Area** always appends. If a line has no range, or an invalid one, the current farming range is used for it.

### Edit Levelarea

Draws every area of the loaded list on the map window as a dot, with the area currently being farmed in a different colour. **Clicking a dot removes that area.**

On clients that have no map window the dots can't be drawn — use the **Areas** box and **Remove selected** instead.

### Set: Waithack Range = Area Range

Every area carries its own range, taken from the farming range at the moment you created it. With this ticked, the waithack range is set to match the range of each area as the bot enters it, so [Waithack](/private-servers/waithack.md) covers exactly the area being farmed instead of a fixed radius. It does nothing on clients without waithack.

## Go to next Area if

These decide when the bot gives up on the area it is in and moves to the next one. Tick as many as you like — **the first one that applies wins**.

* **After x Seconds** — Leave once the bot has been in the area that long, whether or not there is still something to kill. Counted from the moment it arrives, not from when the area was picked.
* **Less than x Monsters** — Leave once fewer than that many targets are left inside the area.
* **Health below %** — Leave when your health drops under that share, to walk away from a spot that is hurting you.
* **Mark area unsafe in low profile mode** — Low profile mode is what STMod switches to when it spots a player it was told to watch for, and what the panic button puts you in. With this ticked, the area the bot was in when that happened is remembered as unsafe and the bot moves on instead of staying where it was seen.
  * **Do not visit for x Seconds** — How long an unsafe area is skipped for. This sub-option is what actually blacklists the area: with it unticked the bot still moves on when low profile hits, but the area is not remembered as unsafe.
  * When every area is unsafe the bot keeps going anyway rather than standing still.
* **Change CH after last Area** — Changes channel once the bot wraps past the end of the list, using the channel settings from the Safety tab.

### When each check runs

The checks are not all evaluated at the same point:

* The **unsafe / low profile** check runs first, and applies even while the bot is still travelling to the area.
* If the bot cannot reach an area within **90 seconds** it gives up on it and moves to the next one.
* The remaining conditions only start once the bot has actually arrived inside the area.
* While the pickup bot still has items waiting to be collected, the checks pause.
* **After x Seconds** is checked as soon as the bot arrives, while **Less than x Monsters** and **Health below %** wait for a short settling period (about 4 seconds) after arrival first.

## What happens when the bot enters an area

The farming centre moves to that area's coordinates, the farming range field is overwritten with the area's own range, the waithack range is synced if **Set: Waithack Range = Area Range** is on, and **Fixed range** / **go to initial position** are re-applied.

When the farmbot starts, the Levelbot jumps to the area **closest to where you are standing**, not to the first one in the list. The status line shows `Area n/total` while it is running, or `Areas: n` when it is idle.
