Setting Up Your Development Environment
Prerequisites
Before you start setting up your development environment, you will need to have the Java Development Kit installed (JDK). Instructions to do so can be found in the Installing JDK section.
You will also need to have DreamBot on your computer and have it launched at least-once so you can have access to the client files.
Integrated development environment
Since the scripts are written in Java you might want to use an Integrated development environment (IDE) to assist you in the creation of your
scripts.
There are multiple IDE's you can choose from. All of them work and are free. They have their own pros and cons which you can personally evaluate. Here
are a few worth taking a look at:
Setting up IntelliJ IDEA
For simplicity’s sake, the IDE chosen to demonstrate this is going to be JetBrains IntelliJ IDEA.
Go to the website above, download and install the latest version of the Community build.
Creating a project
To begin, open up IntelliJ IDEA and you will be presented with a window similar to the following:
- Click on New Project and, in the next window, ensure that you have Java selected as well as IntelliJ for the build system. Then choose the JDK you downloaded in Installing JDK just below build system option, give your script a name and the location you'd like your project to be saved to, then click on Create.
You will now have an empty project.
Configuring the project
Right click on the src folder on the left and select New -> Java Class. You can name it whatever you want. For this example it will be given the name "TestScript"
Adding dependencies
Now you need to add the client as a library to your project. You need this to have access to DreamBot API.
- Click on File up on the top left and click on Project Structure...
- On the opening window click on Libraries on the left. Then click on the + on the top and select Java
- Navigate to the DreamBot BotData folder and select the client.jar file. You can find this folder here:
- Windows:
C:\Users\YOUR_USER\DreamBot\BotData
- Linux / MacOS:
/home/YOUR_USER/DreamBot/BotData
- Windows:
- Press Apply and Ok at the bottom right of the window.
Adding an artifact
In order to compile the script and have it appear on DreamBot you need to create a JAR file (an artifact). This can be done rather easily with IntelliJ.
- Click on File up on the top left and click on Project Structure...
- Select Artifacts on the left. Then click on the + up on top and go to JAR -> From modules with dependencies.... Then on the next windows press OK
- Now you will want to change the Output directory on top to the DreamBot Scripts folder. You can find this folder here:
- Windows:
C:\Users\YOUR_USER\DreamBot\Scripts
- Linux / MacOS:
/home/YOUR_USER/DreamBot/Scripts
- Windows:
- Then you need to remove client.jar dependency from being included in the artifact, you can do this by right clicking the client.jar in the list and selecting remove.
- Press Apply and Ok at the bottom right of the window.
To learn how to set up and run the script go to Running your First Script page.