Hey, i just wanted to leave some feedback. When I first got the script years ago, it was nice but I was already getting a bunch of bans(on all scripts, not just this one) so I might've not been impressed. Coming back to it now, this is an amazing deal for what this script has. So much customization, and now it has MLM, anti-ban options, it has a huge task system, you can make it mine tin/copper to 15, iron to 30 then do MLM, or you can switch back and forth between MLM and ores using diff locations etc.. The script works great. Very happy i bought this a long time ago.
Hello everyone!
A new version of DreamBot is now live!
Changes:
Added Script Scheduler (VIP)
Added -schedule QuickStart arg
Added rare home teleport game bug workaround
Possibly fixed script starting issues
Always remember, to be on the latest version of our client you must run DBLauncher.jar! The client does NOT update itself!
Thanks,
The Dream Team
Hello everyone, it has been a couple years since I released the first part of this so I thought it was about time to write the next part.
Anywho, this will directly build off of what we had in Part 1, which you can find here:
Prerequisites
You should have already have a project with everything we added in Part 1.
Project Layout
This will be the final layout of the project once we're finished:
The Script
Just as in Part 1, let's define what our goals are for the end of this part:
We want to show a GUI to let the user choose if they want to power mine or bank at the nearest bank
Since all great scripts support QuickStart, we also want to support QuickStart parameters to avoid needing manual input from the GUI
We need to add a new task to handling banking, and extend our mining task to let it walk back once it's done banking
src/gui/GUI.java, the script's GUI
Here's the simple GUI that we'll be using:
The final GUI once we add the modes will look like this, just as we designed it above:
Points of Interest:
JFrame: Our GUI class extends JFrame, which is provided by Java's Swing
Constructor: Our constructor takes one parameter, our main script instance, so that we can let it know what mode to start the script in
MigLayout: You can see we set our frame's layout to use MigLayout, this is mostly just preference however I would highly recommend using it as it's pretty easy to learn and extremely powerful
JLabel/JComboBox/JButton: These are all Swing components that make up our GUI, see the link above for more examples of these and how to use them
JComboBox<Miner.Mode> modeComboBox: This is the dropdown that will let the users select which mode they want to use. It's provided all of Miner.Mode's possible values, which we'll add below. I prefer using enums instead of String's or anything else here simply because it's much harder to mess up and it allows us to add more (or change) modes in the future without ever worrying about the GUI class.
src/Miner.java, the script's main class
Show the GUI
We have a few changes we have to make to our main class to show the new GUI and use the mode it sends over, so let's remove this line from our onStart:
addNodes(new MiningTask(), new DropTask());
and add this line in its place:
SwingUtilities.invokeLater(() -> new GUI(this));
This will create and pass in the script instance so the GUI can let the know script once the users chooses a mode. You should always perform any Swing component creation or modification on the AWT thread, which you can do just by wrapping it in that invokeLater.
Add the Mode Enum
Now we'll need to provide the script modes we want the GUI to show, so we add this at the bottom of our script class (but still before the final closing curly brace):
public enum Mode {
POWER_MINE, BANK;
@Override
public String toString() {
// We override the toString so the GUI can show friendlier options than POWER_MINE to the user
switch (this) {
case POWER_MINE:
return "Power mine";
case BANK:
return "Bank at the nearest bank";
default:
return "Blame Yeeter";
}
}
}
Add the setMode Method
Now we have the mode enum which the GUI will use to show available options, but we still need to create the setMode method we used in the GUI class, which you can add after your onPaint:
/**
* This adds the tasks necessary to run the script in the provided {@link Mode}
* @param mode the script mode to use
*/
public void setMode(Mode mode) {
addNodes(new MiningTask()); // We always want to mine
switch (mode) {
case POWER_MINE:
addNodes(new DropTask()); // Add the drop task if the user selected power mining
break;
case BANK:
addNodes(new BankTask()); // Add the bank task if they chose banking
break;
}
}
QuickStart Support
So now the GUI can set the script's mode, but what if you want to support QuickStart so you don't have to use a GUI every time?
Supporting QuickStart script parameters is pretty easy, as the client will call onStart(String...) instead of the normal onStart we have now, so we can support it by adding in this new onStart after our current one:
/**
* This onStart is called only if the user starts the script using QuickStart with parameters.
*
* We check the parameters to see how to set the script up without needing to show a GUI that would require user
* input.
*
* @param params the QuickStart parameters passed in from the command line
*/
@Override
public void onStart(String... params) {
// Start DreamBot's skill tracker for the mining skill, so we can later see how much experience we've gained
SkillTracker.start(Skill.MINING);
if (params != null && params.length > 0) {
String modeParameter = params[0]; // Grab the first parameter passed via QuickStart
if ("powermine".equalsIgnoreCase(modeParameter)) {
setMode(Mode.POWER_MINE);
} else if ("bank".equalsIgnoreCase(modeParameter)) {
setMode(Mode.BANK);
} else {
Logger.error("Unknown script mode: '" + modeParameter + "', try 'bank' or 'powermine' instead.");
stop();
}
}
}
That's it!
If you followed along above, our Miner.java class should look like this now:
src/tasks/BankTask.java, the banking task
Now that the GUI (and QuickStart) can set the script mode, we need to add the final missing piece which is banking support:
So just like the DropTask class, the BankTask class will execute if the inventory is full. It's a fairly simple class that just walks towards the nearest bank and deposits everything (except your pickaxe). DreamBot knows about most of the banks in the game, and our web walker is capable of walking to a vast majority of the map without needing more information from the scripter. This is why you're able to just call Bank#open (or Walking#walk) from anywhere and it knows where to go, regardless of where you start this script.
src/tasks/MiningTask.java, the mining task
Back to our MiningTask class, we now need to add a couple things since now after banking we'll be lost and have no clue how to get back to the rocks we were mining earlier.
First we'll add a new class member which is a Tile where we'll store the last mined rock location, just add this right after the first opening curly brace:
public class MiningTask extends TaskNode {
private Tile lastMinedRockTile = null;
// the rest of the script
Now we need to set this tile whenever we interact with a rock, so we can add that right after interacting with a rock:
if (rock.interact("Mine")) { // If we successfully click on the rock
lastMinedRockTile = rock.getTile(); // Set the last rock tile in case we need to walk back at some point
Sleep.sleepUntil(this::isMining, 2500); // Wait until we're mining, with a max wait time of 2,500ms (2.5 seconds)
}
So now that tile is set after we interact with any rocks, so let's let the script walk us back here if we're too far away (most likely from banking) which we can do inside of our null check of the rock:
if (rock == null) { // If there aren't any available rocks near us
if (lastMinedRockTile != null && lastMinedRockTile.distance() > 8) { // and we're far from the last mined rock
Walking.walk(lastMinedRockTile); // we should walk towards that rock
Sleep.sleepUntil(Walking::shouldWalk, () -> Players.getLocal().isMoving(), 1000, 100);
return 100;
}
// We should just wait until one's available
return Calculations.random(500, 1000);
}
Finally, let's add one more check to our getClosestRock method to make sure we're close enough to it:
/**
* Finds the closest acceptable rock that we can mine
*
* @return The closest GameObject that has the name 'Rocks', with the action 'Mine', and non-null model colors
* within 10 tiles
*/
private GameObject getClosestRock() {
return GameObjects.closest(object -> object.getName().equalsIgnoreCase("Rocks") &&
object.hasAction("Mine") &&
object.distance() < 10 && // new distance check here
object.getModelColors() != null);
}
That's it!
If you followed along above, our MiningTask.java class should look like this now:
We're Done!
Now just as before, just compile and build the artifact and try out the script.
Attached below is the entire project source that you can use in case you got lost anywhere.
If you have any questions or have anything you'd like to see included for the end result, please post it below.
Thanks for reading!
Miner-Part-2.zip
Thank you so much for the reply!! After posting this, I have had about 90-95% success rate with using this script. And as for the bug, no worries! I really appreciate you and all the Nano scripts. In my opinion these are the ABSOLUTE BEST scripts I have ever used!!!
Hello everyone!
A new version of DreamBot is now live!
Changes:
[BREAKING] Removed deprecated classes, methods, and fields carried over from DreamBot 2
If your private script no longer functions (very likely if it hasn't been updated for these changes) you can still access the previous build of the client here: https://downloads.dreambot.org/dreambot-3.13.21-legacy.jar. Please note that this will not be updated forever, so please have your private script updated to support the latest build of the client.
Completely reworked Local and Web pathfinders (see thread) and walking itself
New Web Walking nodes include:
Gnome Gliders
Charter Ships
Spirit Trees
Fairy Rings
Teleports including magic, items, and equipment
Path finding is now much more randomized, allowing for various different paths to be taken locally and via the web pathfinder
Improved performance
More human-like tile selection when walking
Cleaned and refactored our internals
Just a reminder that all injectables features are currently in beta testing and as such are VIP+ features only. You can find information on the injectables here.
Always remember, to be on the latest version of our client you must run DBLauncher.jar! The client does NOT update itself!
Thanks,
The Dream Team
Loots & Banks Cowhides from other players at south-east falador farm.
[ADD SCRIPT LINK]
Features:
Anti-Ban Option
Stable Logic Path
Mouse Hop Option
Informative Paint
World Switches when there is no-one killing cows
Capable of profiting around 10-30k gp/h (Depends on players)
Start at the eastern Falador bank
No skill requirements for this script
Notes:
The bot does NOT kill cows.
It only takes the cowhides that are on ground and not been taken by other players.
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.