Getting Started
To setup your playerbot-lua development environment, follow the installation instructions below.
Installation instructions (Windows):
The following instructions will guide you through installing the playerbot CLI to a global location (optional) and initializing a script source directory.
- In a global location, such as C:\Program Files\, create a folder calledPlayerbot CLI.
- Download the file playerbot.zipfrom the latest release.
- Right click on the downloaded file and choose Extract Allfrom the context menu.
- In the destination text box, enter the folder path created in step 1 e.g. C:\Program Files\Playerbot CLI\and pressExtract.
- Open the windows start menu, and begin typing environment variables. Choose the first resultEdit the system environment variables. ASystem Propertieswindow will appear.
- Click the Environment Variables...button at the bottom right. AEnvironment Variableswindows will appear.
- In the first table in the new window titled User variables for <user>, locate and double click on the row with the variable namePath. A new window titledEditor Environment Variablewill appear.
- Press the Newbutton at the top right of the window. A new row in the table will appear.
- In the new row text box, enter the folder location of playerbot.exee.g.C:\Program Files\Playerbot CLI\.
- Click Okat the bottom of theEditor Environment Variablewindow, theEnvironment Variableswindow, and theSystem Propertieswindow.
- Open a new terminal such as PowershellorCommand Promptor open VS Code and run a terminal (CTRL+SHIFT+`) at the location where the lua script files will be located (if a terminal is already open, close and re-open it or restart VS Code).
- Run the command playerbot. The directory will be initialized with a configuration file.
- In the WoW client, run the command .bot ai get token. Enter the provided token into the configuration file'sTOKENfield value.
- Modify the configuration file to update the API_HOSTandLOG_HOSTaddresses to point to the correct location. If desired, change the relative path where lua script files should be stored (default issrc/).
- Run the command playerbotagain. It will attempt to authorize the token. If successful, the provided directory will initialize.
- Run the command playerbot -deploy. The hello world provided script will deploy.
- Add a bot as normal using the command bot add <name>.
- In-game, run the command .bot ai use luato switch to lua scripting mode.
- A system message will appear as instructed in main.luawhich will readAI scripting is alive :).
- Outside the game, edit the main.luascript file to change the printed string to something else, e.g.AI scripting is alive!.
- In-game, run the command .bot ai load. The changed string will appear printed as written.
- For more information on what the CLI can do, run the command playerbot --helpor check the documentation.
Workflow
- Login to the WoW server and choose your master character.
- In the in-game chat, run the command .bot ai use lua.
- Run the command .bot ai get tokenand updateconfig.ymlin your script source directory with the updated token if necessary.
- Begin scripting using the API.
- Once you'd like to your run your scripts, run playerbot -deploy.
- In-game, run the command .bot ai load.
Repeat steps 4 through 6 as you develop your scripts. If you get errors on deployment indicating that your token has expired, repeat step 3.
Bug reports, suggestions, or any other questions should be created as issues here.