NOT MY TUT OK Just a addon to my install tut
1) Make sure you have downloaded and installed the latest JDK SE from http://java.sun.com/javase/downloads/index.jsp (JDK 6 Update 20). If you are running a relatively new computer, it might be running 64-bit windows rather than the typical 32-bit version. In this case you must select "Windows x64" rather than "Windows" when downloading the JDK. If you are not sure which version of Windows you have, you can easily find out using the following guide: http://support.microsoft.com/kb/827218.
2) Open up RSBot (the .jar file that you have downloaded from rsbot.org) 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:
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:
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:
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:
Answer: Open up RSBot (the .jar) and compile again.
For Tutorial on how to install rsbot go here http://www.runescapeforums.org/thread-298.html
1) Make sure you have downloaded and installed the latest JDK SE from http://java.sun.com/javase/downloads/index.jsp (JDK 6 Update 20). If you are running a relatively new computer, it might be running 64-bit windows rather than the typical 32-bit version. In this case you must select "Windows x64" rather than "Windows" when downloading the JDK. If you are not sure which version of Windows you have, you can easily find out using the following guide: http://support.microsoft.com/kb/827218.
2) Open up RSBot (the .jar file that you have downloaded from rsbot.org) 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 "";
}
}
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 up RSBot (the .jar) and compile again.
For Tutorial on how to install rsbot go here http://www.runescapeforums.org/thread-298.html