Creating a DreamBot 3 script for Old School RuneScape (OSRS) involves setting up a basic Java template that interacts with the official DreamBot API to perform botting actions such as walking, interacting with NPCs, skilling, and more.
Below is a simple and well-commented template script for DreamBot 3 using Java. This can serve as the base for more complex scripts like woodcutting bots, combat bots, fishing bots, etc.
✅ Prerequisites
Make sure:
- You have DreamBot 3 installed.
- You have a Java development environment (e.g., IntelliJ IDEA or Eclipse).
- You’ve set up DreamBot’s client DevKit.
- You’re using Java 8 or compatible with DreamBot’s current supported version.
🔧 Basic DreamBot 3 Script Template - MyFirstScript
package your.package.name;
import org.dreambot.api.methods.tabs.Tabs;
import org.dreambot.api.methods.tabs.Tab;
import org.dreambot.api.script.AbstractScript;
import org.dreambot.api.script.Category;
import org.dreambot.api.script.ScriptManifest;
@ScriptManifest(
author = "YourName",
name = "MyFirstScript",
version = 1.0,
description = "A basic DreamBot 3 script template.",
category = Category.MISC
)
public class MyFirstScript extends AbstractScript {
@Override
public void onStart() {
// This is called when the script starts
log("Script has started!");
}
@Override
public int onLoop() {
// This method is called repeatedly in a loop (~600ms default)
// Example: Open Inventory Tab
if (!Tabs.isOpen(Tab.INVENTORY)) {
Tabs.open(Tab.INVENTORY);
}
// Add your core botting logic here...
log("Running main bot logic...");
// Return delay before next loop in MS (e.g., 600ms)
return 600;
}
@Override
public void onExit() {
// This is called when the script is stopped
log("Script has stopped.");
}
@Override
public void onPaint(java.awt.Graphics g) {
// Optional: Paint custom info on the screen
g.drawString("MyFirstScript is running!", 10, 300);
}
}
🧪 How to Run the Script
-
Compile the Script:
- Use your IDE or command line to compile the
.java file.
- Make sure DreamBot’s client API
.jar is in your build path.
-
Export the JAR File:
- Export the compiled script into a JAR file.
- Place it in the
DreamBot/Scripts folder.
-
Start DreamBot Client:
- Launch DreamBot.
- Log in and start the script from the script manager.
🔨 Next Steps: Expand the Script Template
Depending on what you want the script to do, you can plug-in other DreamBot features:
-
Banking
import org.dreambot.api.methods.container.impl.bank.Bank;
if (!Bank.isOpen()) {
Bank.open();
}
-
Walking to a tile
import org.dreambot.api.methods.walking.impl.Walking;
import org.dreambot.api.wrappers.interactive.GameObject;
import org.dreambot.api.methods.map.Tile;
Tile tile = new Tile(3200, 3200); // example coordinates
if (Walking.shouldWalk(5)) {
Walking.walk(tile);
}
-
Interacting with Trees/NPCs
GameObject tree = getGameObjects().closest("Tree");
if (tree != null && tree.interact("Chop down")) {
sleepUntil(() -> !tree.exists(), 10000);
}
✅ Tips
- Always test in isolated accounts.
- Use
sleepUntil() and ConditionalSleep for better timing control.
- Avoid hardcoding unless necessary.
- Implement antiban techniques to mimic human interaction patterns.
Would you like an example for a specific skill/task, like fishing, combat, mining, cooking, etc.? Let me know and I’ll tailor the template to that task.