# Your first bot

Spawn a bot, see what it's up to, and send it away when you're done.

import { AccordionItem, Accordions, Steps } from '@prosefly/astro-components';

Every AI Players command starts with `/aiplayer`, or its shorter alias `/aip`. You need to be a server operator
(or have cheats on in singleplayer) to spawn and manage bots.

<Steps>

1. **Spawn a bot.** Stand where you want it to appear and run:

   ```txt title="Command"
   /aiplayer spawn Steve
   ```

   A player called Steve appears next to you, shows up in the tab list and joins the game like anyone else.

2. **Give it a skin (optional).** Add a play style, a faction and the name of any Minecraft account to borrow
   its skin:

   ```txt title="Command"
   /aiplayer spawn Alex aiplayers:neutral none Notch
   ```

   `aiplayers:neutral` is the balanced default [play style](/ai-players/guide/play-styles/), and `none` means no
   [faction](/ai-players/guide/factions/) for now.

3. **Watch it play.** Steve starts with an empty inventory. Within a few minutes it's chopping trees and crafting
   a table and its first wooden and stone tools. Then it builds a small house with a door, a torch, a furnace, a
   chest and (once it has found some sheep) a bed. Next it hunts and cooks food, digs for iron, and makes a shield,
   iron tools and a water bucket. At night it keeps working inside its base and mine, or fishes if there's water in
   its yard. Follow it around or check on it with the commands below.

4. **Remove it when you're done.**

   ```txt title="Command"
   /aiplayer remove Steve
   ```

   The bot leaves the game, but the mod remembers it. `/aiplayer respawn Steve` brings it back exactly as it was.

</Steps>

## Keeping an eye on your bots

| Command                     | What it does                                                        |
| :-------------------------- | :------------------------------------------------------------------ |
| `/aiplayer list`            | Lists every bot, with its status.                                   |
| `/aiplayer info Steve`      | Shows what Steve is doing right now, its health, home, faction and more. |
| `/aiplayer tp Steve`        | Teleports **you** to Steve.                                         |
| `/aiplayer tphere Steve`    | Teleports Steve to you.                                             |

With the [client add-on](/ai-players/guide/client-add-on/) on your own game, press **K** for a screen that does
all of this with buttons, and **U** while looking at a bot to see its path and task drawn in the world.

:::tip
Bots keep their inventory, position and memory across server restarts. When the server starts again, every
active bot logs back in where it was and carries on.
:::

## Bot names

A bot's name must be 3 to 16 characters long and use only letters, numbers and underscores, like a real Minecraft
name. It can't be the name of a player who's online right now. If a real player with the same name as a bot logs
in, the real player wins and the bot is sent away (retired) until you bring it back.

## Where to go from here

- Learn [how bots live](/ai-players/guide/how-bots-live/) and what they do on their own.
- Try a different [play style](/ai-players/guide/play-styles/): `/aiplayer spawn Ann aiplayers:rusher`.
- Put a bot in your [faction](/ai-players/guide/factions/) and give it [orders](/ai-players/guide/orders/).

## Technical details

<Accordions>
  <AccordionItem title="The full spawn syntax">
    ```txt title="Syntax"
    /aiplayer spawn <name> [<style>] [<faction>] [<skin username>]
    ```

    The arguments are positional, so to give a faction you need a style before it, and to give a skin you need both.
    Use `none` in the faction slot for no faction, and `default` in the skin slot to force the default skin.
    Without a skin argument, the bot takes a skin from the `default_skins` list in the
    [server configuration](/ai-players/reference/server-config/) (picked by its name), or the default Steve/Alex skin
    when that list is empty. There are no difficulty or position arguments, so use `set <bot> difficulty`
    and `tphere` afterwards. Every command is listed in the [commands reference](/ai-players/reference/commands/).
  </AccordionItem>
  <AccordionItem title="Bot UUIDs">
    A bot's UUID is derived from its name (`aiplayers:` plus the lowercase name), so it never collides with a real
    online or offline-mode account, and the same name always maps to the same bot.
  </AccordionItem>
  <AccordionItem title="What does /aiplayer info show?">
    `info` prints a compact report with the bot's status, faction and role, style, difficulty, respawn mode,
    cheats, skin, position, deaths and health. After that come its worn armor and active potion effects, its
    current objective and score, the task it's running, what it remembers (home, bed, base, enchanting corner,
    Nether camp, mines, farm, potions, villages, Nether structures, enemies, enemy bases, grudges) and its orders. The lines are
    explained in [Inspecting and debugging bots](/ai-players/reference/debugging/).
  </AccordionItem>
</Accordions>
