How to setup Powerbot, get scripts, and the V1.9
By: JeterFan428
By: JeterFan428
Table of Contents
- 1.0 - Introduction
- 2.0 - Step 1. Getting JRE and JDK
- 3.0 - Step 2a: Setting the Environmental Variables (Windows XP)
- 4.0 - Step 2b: Setting the Environmental Variables (Windows 7)
- 5.0 - Step 3: Getting TortoiseSVN and PowerBot
- 6.0 - Frequently Asked Questions
- 7.0 - Credits
- 8.0 - Adding scripts
- 9.0 - How to get V1.9
_____________________________________________________________________
1.0 - Introduction
This is a guide on how to setup Powerbot (Formerly known as RSbot) for Windows XP and 7, get scripts for it, and get the new V1.9.
_____________________________________________________________________
Setting up the bot!
2.0 - Step 1: Getting JRE and JDK
Go here to get the latest version of JRE.
Go here to get the latest version of JDK.
_____________________________________________________________________
3.0 - Step 2a: Setting the Environmental Variables (Windows XP)
Go to Start, right click on My Computer and click on Properties.
Click the Advanced tab then click Environmental Variables.
Under the first box click new.
Type PATH for the variable name and C:\Program Files\Java\jdk1.6.0_19\bin for the variable value.
Restart your computer.
_____________________________________________________________________
4.0 - Step 2b: Setting the Environmental Variables (Windows 7)
Go to start, right click on Computer and click Properties.
Click Advanced System Settings.
Click Environmental Variables
Under the first box click new.
Type PATH for the variable name and C:\Program Files\Java\jdk1.6.0_19\bin for the variable value.
Restart your computer.
_____________________________________________________________________
5.0 - Step 3: Getting TortoiseSVN and RSBot
Go here to get TortoiseSVN.
Restart computer, if necessary.
Right click on your desktop and click on SVN checkout.
Copy and paste svn://dev.powerbot.org/rsbot/trunk into the URL of repository blank
Click OK and your RSBot folder should be created.
_____________________________________________________________________
Q: How do I fix the "Attempt to show world" error?
A: Log into your account on http://runescape.com on any world. After you successfully log in, exit and run the bot again.
Q: When I start the bot, all it does is show a white screen. How do I fix this?
A: Go to the graphics settings and switch it to safe mode then put all the settings to the lowest.
_____________________________________________________________________
7.0 - Credits
RSBot: Making the bot.
DarkFang: Letting me edit his tutorial.
_____________________________________________________________________
How to add scripts!
8.0 - Adding scripts
1.) Make sure you have downloaded and installed the newest version of JDK. The download link is located in "2.0 - Step 1: Getting JRE and JDK"
2.) Open up RSBot if you have not done so before. If you have opened it before, then you do not have to open it up again (although you can if you want to), simply make sure that you have opened it AT LEAST ONCE since you downloaded it.
3.) RSBot will have created some folders for you in your Documents folder. Open up "Documents" ("My Documents" on Windows XP) and open up the folder "RSBot". Within here you will see a folder called "Scripts".
4.) Download the script you want and as save it into the scripts folder. Here is how to do so:
Some scripters will give you a link to the script, which you can click on to download it. In this case, as long as you download the ".java" file, you simply have to move it into the "Scripts" folder in your "RSBot" folder. Otherwise, if the code itself is posted on the forums, you need to copy it all and paste it into a new Notepad document (Start > All Programs > Accessories > Notepad). Near the top of all that code (below all the lines that start with 'import') you will see the words 'public class xxxxx extends Script'. The xxxxx will be the name of the script. Save the file as xxxxx.java (this is case sensitive!).
Example:
Code:
import org.rsbot.bot.Bot;
import org.rsbot.event.events.ServerMessageEvent;
import org.rsbot.event.listeners.PaintListener;
import org.rsbot.event.listeners.ServerMessageListener;
import org.rsbot.script.Constants;
import org.rsbot.script.Script;
import org.rsbot.script.ScriptManifest;
import org.rsbot.script.wrappers.RSInterface;
import org.rsbot.script.wrappers.RSObject;
import java.awt.*;
import java.util.ArrayList;
import java.util.Map;
@ScriptManifest(authors = { "Squirrels" }, category = "Woodcutting", name = "Squirrels Chop And Drop Global Edition", version = 1.0)
public class GlobalChopAndDrop extends Script implements PaintListener, ServerMessageListener {
//log id's
private final int[] Reg = new int[] { 1278, 1276, 1282, 1286};
private final int[] Oak = new int[] { 1281};
private final int[] Willow = new int[] { 5553, 5552, 5551, 1308};
private final int[] Maple = new int[] { 1307};
private final int[] Yew = new int[] { 1309};
private final int[] Magic = new int[] { 1306};
private final int[] Teak = new int[] { 9036};
//Logs etc that should be dropped.
private final int[] DropItems = new int[] { 1511, 1513, 1515, 1517, 1519, 1521, 6333 };
private int CurrentState = 0;
private int chopped = 0;
private int trades = 0;
private long lastTrade;
private long startTime;
private int[] tree;
private String CurrentChop;
public GlobalChopAndDrop() {
lastTrade = System.currentTimeMillis();
}
public String getScriptDescription( ) {
String html = "";
html += "<html>\n";
html += "<body>\n";
html += "<font size='5' color='green'>";
html += "<center><h2>Global Chop And Drop</h2></center>\n";
html += "</font>";
html += "<b>Made By: </b>Squirrels<br/>";
html += "<b>Version: </b>1.0<br/><br/>";
html += "<center><b>Start by any tree and start the script.</b></center>";
html += "<center><b>Choose what tree you would like to cut and press start.</b></center>";
html += "<p><center>Tree to cut: ";
html += "<select name='log'>";
html += "<option>Regular";
html += "<option>Oak";
html += "<option>Willow";
html += "<option>Maple";
html += "<option>Teak";
html += "<option>Yew";
html += "<option>Magic";
html += "</select>";
html += "<br />";
html += "<br />";
html += "<br />";
html += "<br /></center></p>";
html += "</body>\n";
html += "</html\n";
return html;
}
public boolean onStart(Map<String, String> args) {
startTime = System.currentTimeMillis();
CurrentChop = (args.get("log"));
if (args.get("log").equals("Regular")) {
tree = Reg;
}
if (args.get("log").equals("Oak")) {
tree = Oak;
}
if (args.get("log").equals("Willow")) {
tree = Willow;
}
if (args.get("log").equals("Maple")) {
tree = Maple;
}
if (args.get("log").equals("Yew")) {
tree = Yew;
}
if (args.get("log").equals("Magic")) {
tree = Magic;
}
if (args.get("log").equals("Teak")) {
tree = Teak;
}
log.info("-");
log.info("--");
log.info("--");
log.info("Squirrels Global Chop And Drop Activated we are currently chopping " + CurrentChop + ".");
log.info("--");
log.info("--");
log.info("-");
return true;
}
public void onRepaint(Graphics g) {
if (isLoggedIn()) {
long millis = System.currentTimeMillis() - startTime;
long hours = millis / (1000 * 60 * 60);
millis -= hours * (1000 * 60 * 60);
long minutes = millis / (1000 * 60);
millis -= minutes * (1000 * 60);
long seconds = millis / 1000;
// 173 and 80 decide width and height respectively
int topX = 515 - 190, topY = 337 - 80, x = topX + 5, y = topY + 5;
g.setColor(new Color(0, 100, 0, 100));
g.fill3DRect(topX, topY, 515 - topX, 337 - topY, true);
g.setColor(Color.green);
g.drawString("Runtime: " + hours + "h " + minutes + "min "
+ seconds + "sec.", x, y += 15);
g.drawString("Choped " + chopped + " " + CurrentChop + " Logs.", x, y += 15);
g.drawString("Currently Chopping " + CurrentChop + ".", x, y += 15);
g.drawString("Been traded " + trades + " times.", x, y += 15);
}
}
public void onFinish() {
Bot.getEventManager().removeListener(PaintListener.class, this);
}
public int loop() {
try {
switch (CurrentState) {
case 0:
if (isInventoryFull()) {
CurrentState = 1;
} else if (getMyPlayer().getAnimation() == -1) {
RSObject nearTree = getNearestObjectByID(tree);
if (atTree(nearTree, "Chop Down")) {
wait(random(3000, 4000));
}
}
break;
case 1:
while (inventoryContainsOneOf(DropItems)) {
clickInventoryItem(DropItems, "Drop");
}
CurrentState = 0;
default:
break;
}
} catch (Exception e) {
}
return antiBan();
}
//AntiBan thanks to Epic_
public int antiBan() {
final int ranNo = random(0, 15);
int angle;
switch (ranNo) {
case 1:
angle = getCameraAngle() + random(-90, 90);
if (angle < 0) {
angle = 0;
}
if (angle > 359) {
angle = 0;
}
setCameraRotation(angle);
case 2:
moveMouse(random(0, 650), random(0, 400));
return random(200, 400);
case 3:
if (getCurrentTab() != Constants.TAB_INVENTORY) {
openTab(Constants.TAB_INVENTORY);
return random(200, 400);
}
case 4:
moveMouse(random(0, 700), random(0, 500));
return random(200, 400);
case 5:
angle = getCameraAngle() + random(-90, 90);
if (angle < 0) {
angle = 0;
}
if (angle > 359) {
angle = 0;
}
setCameraRotation(angle);
}
return random(200, 450);
}
public boolean clickInventoryItem(int[] itemIDs, String option) {
if (getCurrentTab() != TAB_INVENTORY
&& !RSInterface.getInterface(INTERFACE_BANK).isValid()
&& !RSInterface.getInterface(INTERFACE_STORE).isValid()) {
openTab(TAB_INVENTORY);
}
int[] items = getInventoryArray();
java.util.List<Integer> possible = new ArrayList<Integer>();
for (int i = 0; i < items.length; i++) {
for(int j = 0; j < itemIDs.length; j++) {
if (items[i] == itemIDs[j]) {
possible.add(i);
break;
}
}
}
if (possible.size() == 0) {
return false;
}
int idx = possible.get(random(0, possible.size()));
Point t = getInventoryItemPoint(idx);
moveMouse(t, 5, 5);
long waitTime = System.currentTimeMillis() + random(50, 250);
boolean found = false;
while (!found && System.currentTimeMillis() < waitTime) {
wait(15);
if ((getMenuItems()).get(0).toLowerCase().contains(
option.toLowerCase())) {
found = true;
}
}
if (found) {
clickMouse(true);
wait(random(150, 250));
return true;
}
clickMouse(false);
wait(random(150, 250));
return atMenu(option);
}
public void serverMessageRecieved(ServerMessageEvent e) {
String CM = e.getMessage();
if (CM.contains("You get some ")) {
chopped++;
}
if (CM.contains("wishes to trade with you") && lastTrade < System.currentTimeMillis() - 5000) {
sendText(getResponse(), true);
trades++;
lastTrade = System.currentTimeMillis();
}
}
private String getResponse() {
int rand = random(0, 5);
switch (rand) {
case 0:
if (trades <5){
return "nty";
}
case 1:
if (trades <5){
return "no";
}
case 2:
if (trades <5){
return "no ty";
}
case 3:
if (trades <5){
return "nop";
}
case 4:
if (trades <5){
return "no thx";
}
}
return "";
}
}
private int trades = 0;
private long lastTrade;
private long startTime;
private int[] tree;
private String CurrentChop;
public GlobalChopAndDrop() {
lastTrade = System.currentTimeMillis();
}
public String getScriptDescription( ) {
String html = "";
html += "<html>\n";
html += "<body>\n";
html += "<font size='5' color='green'>";
html += "<center><h2>Global Chop And Drop</h2></center>\n";
html += "</font>";
html += "<b>Made By: </b>Squirrels<br/>";
html += "<b>Version: </b>1.0<br/><br/>";
html += "<center><b>Start by any tree and start the script.</b></center>";
html += "<center><b>Choose what tree you would like to cut and press start.</b></center>";
html += "<p><center>Tree to cut: ";
html += "<select name='log'>";
html += "<option>Regular";
html += "<option>Oak";
html += "<option>Willow";
html += "<option>Maple";
html += "<option>Teak";
html += "<option>Yew";
html += "<option>Magic";
html += "</select>";
html += "<br />";
html += "<br />";
html += "<br />";
html += "<br /></center></p>";
html += "</body>\n";
html += "</html\n";
return html;
}
public boolean onStart(Map<String, String> args) {
startTime = System.currentTimeMillis();
CurrentChop = (args.get("log"));
if (args.get("log").equals("Regular")) {
tree = Reg;
}
if (args.get("log").equals("Oak")) {
tree = Oak;
}
if (args.get("log").equals("Willow")) {
tree = Willow;
}
if (args.get("log").equals("Maple")) {
tree = Maple;
}
if (args.get("log").equals("Yew")) {
tree = Yew;
}
if (args.get("log").equals("Magic")) {
tree = Magic;
}
if (args.get("log").equals("Teak")) {
tree = Teak;
}
log.info("-");
log.info("--");
log.info("--");
log.info("Squirrels Global Chop And Drop Activated we are currently chopping " + CurrentChop + ".");
log.info("--");
log.info("--");
log.info("-");
return true;
}
public void onRepaint(Graphics g) {
if (isLoggedIn()) {
long millis = System.currentTimeMillis() - startTime;
long hours = millis / (1000 * 60 * 60);
millis -= hours * (1000 * 60 * 60);
long minutes = millis / (1000 * 60);
millis -= minutes * (1000 * 60);
long seconds = millis / 1000;
// 173 and 80 decide width and height respectively
int topX = 515 - 190, topY = 337 - 80, x = topX + 5, y = topY + 5;
g.setColor(new Color(0, 100, 0, 100));
g.fill3DRect(topX, topY, 515 - topX, 337 - topY, true);
g.setColor(Color.green);
g.drawString("Runtime: " + hours + "h " + minutes + "min "
+ seconds + "sec.", x, y += 15);
g.drawString("Choped " + chopped + " " + CurrentChop + " Logs.", x, y += 15);
g.drawString("Currently Chopping " + CurrentChop + ".", x, y += 15);
g.drawString("Been traded " + trades + " times.", x, y += 15);
}
}
public void onFinish() {
Bot.getEventManager().removeListener(PaintListener.class, this);
}
public int loop() {
try {
switch (CurrentState) {
case 0:
if (isInventoryFull()) {
CurrentState = 1;
} else if (getMyPlayer().getAnimation() == -1) {
RSObject nearTree = getNearestObjectByID(tree);
if (atTree(nearTree, "Chop Down")) {
wait(random(3000, 4000));
}
}
break;
case 1:
while (inventoryContainsOneOf(DropItems)) {
clickInventoryItem(DropItems, "Drop");
}
CurrentState = 0;
default:
break;
}
} catch (Exception e) {
}
return antiBan();
}
//AntiBan thanks to Epic_
public int antiBan() {
final int ranNo = random(0, 15);
int angle;
switch (ranNo) {
case 1:
angle = getCameraAngle() + random(-90, 90);
if (angle < 0) {
angle = 0;
}
if (angle > 359) {
angle = 0;
}
setCameraRotation(angle);
case 2:
moveMouse(random(0, 650), random(0, 400));
return random(200, 400);
case 3:
if (getCurrentTab() != Constants.TAB_INVENTORY) {
openTab(Constants.TAB_INVENTORY);
return random(200, 400);
}
case 4:
moveMouse(random(0, 700), random(0, 500));
return random(200, 400);
case 5:
angle = getCameraAngle() + random(-90, 90);
if (angle < 0) {
angle = 0;
}
if (angle > 359) {
angle = 0;
}
setCameraRotation(angle);
}
return random(200, 450);
}
public boolean clickInventoryItem(int[] itemIDs, String option) {
if (getCurrentTab() != TAB_INVENTORY
&& !RSInterface.getInterface(INTERFACE_BANK).isValid()
&& !RSInterface.getInterface(INTERFACE_STORE).isValid()) {
openTab(TAB_INVENTORY);
}
int[] items = getInventoryArray();
java.util.List<Integer> possible = new ArrayList<Integer>();
for (int i = 0; i < items.length; i++) {
for(int j = 0; j < itemIDs.length; j++) {
if (items[i] == itemIDs[j]) {
possible.add(i);
break;
}
}
}
if (possible.size() == 0) {
return false;
}
int idx = possible.get(random(0, possible.size()));
Point t = getInventoryItemPoint(idx);
moveMouse(t, 5, 5);
long waitTime = System.currentTimeMillis() + random(50, 250);
boolean found = false;
while (!found && System.currentTimeMillis() < waitTime) {
wait(15);
if ((getMenuItems()).get(0).toLowerCase().contains(
option.toLowerCase())) {
found = true;
}
}
if (found) {
clickMouse(true);
wait(random(150, 250));
return true;
}
clickMouse(false);
wait(random(150, 250));
return atMenu(option);
}
public void serverMessageRecieved(ServerMessageEvent e) {
String CM = e.getMessage();
if (CM.contains("You get some ")) {
chopped++;
}
if (CM.contains("wishes to trade with you") && lastTrade < System.currentTimeMillis() - 5000) {
sendText(getResponse(), true);
trades++;
lastTrade = System.currentTimeMillis();
}
}
private String getResponse() {
int rand = random(0, 5);
switch (rand) {
case 0:
if (trades <5){
return "nty";
}
case 1:
if (trades <5){
return "no";
}
case 2:
if (trades <5){
return "no ty";
}
case 3:
if (trades <5){
return "nop";
}
case 4:
if (trades <5){
return "no thx";
}
}
return "";
}
}
You would save the script above as GlobalChopAndDrop.java
5.) Go back to your "RSBot" folder and click "Compile-Scripts". This will convert all your scripts into .class files (which RSBot will be able to load in). If you pasted the script correctly, you will now see that the script has been added when you go to File > Run Script. There is no need to restart RSBot, as the scripts will be loaded in every time you do File > Run Script.
If you paste a script in incorrectly, then RSBot will not load in some of your other scripts. If this happens delete the .java file and try again or contact the author of the script.
You should be good to go now, and able to add any script you want. However, if you are having problems, perhaps the following section of answers to frequently asked questions will help you out.
FAQS:
1.) When I compile I get the following:
Code:
Note: scripts\GlobalChopAndDrop.java uses or overides a deprecated API.
Note: Recompile with -Xlint:deprecation for details
Answer: You can ignore any lines with 'Note:' at the beginning. This is just a note to scripters. This file has compiled fine. Some scripts will give these notes, most will not.
2.) When I compile I get the following:
Code:
Scripts\GlobalChopAndDrop.java:284: reached end of file while parsing
}
^
1 error
Answer: You have not copied the script correctly. Make sure you copy everything. You have probably missed out a '}' at the end of the script.
3.) When I compile I get the following:
Code:
Path file does not exist. Please run RSBot and try again.
Answer: Open RSBot and compile it again.
Thank you Jacmob for letting me edit your tutorial.
_____________________________________________________________________
How To Obtain The New RSBot V1.9 + The Difference Between Both Clients
9.0 - How to get V1.9
The Difference
The difference between RSBot v1.9 and 1.23 is that v1.23 has the old API methods, and V1.9 has the new methods. There is a huge difference between them, so be sure to check what version of RSBot the script was made for. If you try to add a new API script to the old bot, you will end up with 100 errors when compiling, so you will have to get the new client in order for it to work. Same this for a script with the old API methods in it, and when you try to compile with the new one, it will also end up 100 errors. I recommend getting both RSBot clients so that you can, what I call it, "Double-Bot."
To get the new RSBot V1.9, you will have to use the SVN.
This is the SVN for V1.9 - svn://dev.powerbot.org/rsbot/branches/ng
___________________________________________________________
Step One. You will need to get Tortoise SVN (Posted earlier in the tutorial)
Step Two. After downloading it, right click on your desktop, hover or click your mouse on Tortoise SVN, and then click Repo- Browser. In the text box, you will have to copy and paste the SVN that is posted above.
Step Three. Once you have pressed "Ok" and it has finished showing you the files in the folder, you will have to right click it again, and then go to "SVN Checkout..."
Step Five. Press Ok, and then wait for it to add all the files. You will know it's working if all the files added are in purple, and show up. Once that has finished, you are free to use the new RSBot client~!
Thanks to Rockets for letting me use your tutorial!