Hello today i will be showing you how to make your own rsbot script some of you may know some basic java if so that's good that will help you out alot. but now for the tutorial you will need to download some programs as this will make scripting 100x easier! also at the very bottom are some more downloads for useful tools that will make scripting alot easier
THIS IS NOT 100% FINISH I WILL TOMORROW TAKE APART THE SCRIPT AND SHOW HOW IT WORKS AND WHAT IT DOES!
COULD THIS PLEASE BE STICKYED IT WILL BE UPDATED WITH MORE STUFF SOON!
Downloads Below.
Eclipse (IDE)
http://www.eclipse.org/downloads/dow...-SR1-win32.zip
___
SVN (Download the one your pc is 32 bit or 64 bit)
TortoiseSVN downloads | TortoiseSVN
___
Once you have download svn make a folder call it: RSBot
RSBot (SVN LINK)
rsbot-client - Revision 58: /trunk
___
Now that we are done downloading all the programs. i will now show you how to add SVN to the RSBot folder.
First make the RSBot folder and then right click and click on SVN CHECKOUT
Also please [NOTE] some times it fails if you get a error well trying to checkout just right click again and click update untill you get a thing that looks like the last picture!
Now we need to setup the rsbot folder to the eclipse open it and then do like what is shown in pictures below.
now we will make the script copy the basic stuff below and paste it there where ever you see MyScriptName change that to yours.
Code:
import java.awt.BasicStroke;
import java.aw*****lor;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.RenderingHints;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import javax.imageio.ImageIO;
import org.rsbot.event.listeners.PaintListener;
import org.rsbot.script.Script;
import javax.imageio.ImageIO;
import org.rsbot.event.events.ServerMessageEvent;
import org.rsbot.event.listeners.PaintListener;
import org.rsbot.script.Script;
import org.rsbot.script.ScriptManifest;
import org.rsbot.script.methods.Game;
import org.rsbot.script.methods.Skills;
import org.rsbot.script.wrappers.RSArea;
import org.rsbot.script.wrappers.RSObject;
import org.rsbot.script.wrappers.RSTile;
@ScriptManifest(authors = { "Dead 4 Real" }, keywords = { "Woodcutting" }, name = "MyScriptName", version = 1.0, description = "Cuts willows at draynor and banks")
public class MyScriptName extends Script implements PaintListener {
private final int[] hatchetIDs = { 349, 1351, 1353, 1355, 1357, 1359, 1361, 6739 };//All HatchetIDs
private int bankboothIDs[] = {2213};// bank booth ids
private final int[] treeIDs = { 5551, 5552, 5553 };// all tree ids
private int logIDs = (1519);// willow log id
private int logsCut = 0;//COUNTS LOGS CUT
BufferedImage normal = null;
BufferedImage clicked = null;
final RSTile[] TreestoBank = { new RSTile(3087, 3248), new RSTile(3093, 3243) };// Tiles from trees to bank
final RSTile[] BanktoTrees = { new RSTile(3085, 3241), new RSTile(3088, 3233) };// Tiles from bank to trees
final RSArea BankArea = new RSArea(new RSTile(3095, 3246), new RSTile(3092, 3240));// Bank AREA NW THEN SW TILES
final RSArea TreeArea = new RSArea(new RSTile(3091, 3239), new RSTile(3087, 3223));// Tree AREA NW THEN SW TILES
public void serverMessageRecieved(ServerMessageEvent e) {
if (e.getMessage().contains("get some")) {
logsCut++;
}
}
public void antiban() {
switch (random(1, 200)) {
case 5:
game.openTab(Game.TAB_STATS);
skills.doHover(Skills.INTERFACE_WOODCUTTING);// LOOKS AT WOODCUTTING
sleep(random(1000, 2100));
game.openTab(Game.TAB_INVENTORY);
break;
case 6:
game.openTab(Game.TAB_FRIENDS);// LOOKS AT FRIENDS LIST
sleep(random(1000, 1700));
game.openTab(Game.TAB_INVENTORY);
break;
case 7:
game.openTab(Game.TAB_CLAN);// LOOKS AT CLAN CHAT
sleep(random(1000, 1800));
game.openTab(Game.TAB_INVENTORY);
case 8:
if (random(1, 20) != 1)
return;
int angle = camera.getAngle() + random(-90, 90);// MOVES CAMERA
if (angle < 0) {
angle = random(0, 10);
}
if (angle > 359) {
angle = random(0, 10);
}
camera.setAngle(angle);
break;
case 9:
if (random(1, 5) == 1)
mouse.moveSlightly();// MOVES MOUSE A BIT
case 10:
if (random (0, 12) == 7) {
mouse.moveOffScreen();// PRETENDS TO GO OFF RUNESCAPE FOR A COUPLE SECONDS!
sleep(random(5600, random(7200, 9000)));
}
break;
}
}
public boolean onStart() {
try {
final URL cursorURL = new URL(
"http://i48.tinypic.com/313623n.png");
final URL cursor80URL = new URL(
"http://i46.tinypic.com/9prjnt.png");
normal = ImageIO.read(cursorURL);
clicked = ImageIO.read(cursor80URL);
} catch (MalformedURLException e) {
log("Unable to buffer cursor.");
} catch (IOException e) {
log("Unable to open cursor image.");
}
log("Start at the bank or trees.");
mouse.setSpeed(10);
return true;
}
private final RenderingHints antialiasing = new RenderingHints(
RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
private Image getImage(String url) {
try {
return ImageIO.read(new URL(url));
} catch(IOException e) {
return null;
}
}
private final Color color1 = new Color(102, 102, 102);
private final Color color2 = new Color(153, 153, 153);
private final Color color3 = new Color(0, 0, 0);
private final BasicStroke stroke1 = new BasicStroke(1);
private final Font font1 = new Font("Comic Sans MS", 0, 9);//FONT TYPE AND SIZE (9)
public void onRepaint(Graphics g1) {
Graphics2D g = (Graphics2D)g1;
if (normal != null) {
/*
* Mouse Paint By RsTra
* This is for RSBot 2.0+!
*/
final int mouse_x = mouse.getLocation().x;
final int mouse_y = mouse.getLocation().y;
final int mouse_x2 = mouse.getPressLocation().x;
final int mouse_y2 = mouse.getPressLocation().y;
final long mpt = System.currentTimeMillis()
- mouse.getPressTime();
if (mouse.getPressTime() == -1 || mpt >= 1000) {
g.drawImage(normal, mouse_x - 8, mouse_y - 8, null); //this show the mouse when its not clicked
}
if (mpt < 1000) {
g.drawImage(clicked, mouse_x2 - 8, mouse_y2 - 8, null); //this show the four squares where you clicked.
g.drawImage(normal, mouse_x - 8, mouse_y - 8, null); //this show the mouse as normal when its/just clicked
}
}
g.setColor(color1);
g.fillRoundRect(278, 235, 239, 103, 16, 16);//FILL IN FOR THE SQAURE
g.setColor(color2);
g.setStroke(stroke1);
g.drawRoundRect(278, 235, 239, 103, 16, 16);//SQAURE BACKGROUND
g.setFont(font1);
g.setColor(color3);
g.drawString("MPGH's - Dead 4 Real", 352, 250);// THE TITLE YOU CAN CHANGE!
g.drawString("Logs Cut: "+ logsCut +".", 352, 270);
}
public int loop(){
antiban();
if(inventory.isFull()){
if(BankAre*****ntains(getMyPlayer().getLocation())){
if(!bank.isOpen()){
bank.open();
return random(500, 700);
}
bank.depositAllExcept(hatchetIDs);
if(bank.isOpen()){
bank.close();
return random(500, 700);
}
}else{
if(walking.getDestination() == null || calc.distanceTo(walking.getDestination()) < random(4, 6)){
walking.walkPathMM(TreestoBank);
return random(300, 600);
}
}
}else{
if(TreeAre*****ntains(getMyPlayer().getLocation())){
if(getMyPlayer().getAnimation() != 2846){
RSObject tree = objects.getNearest(treeIDs);
while (getMyPlayer().getAnimation() != -1)
if (!tree.isOnScreen())
camera.turnToTile(tree.getLocation());
if(tree != null){
tree.doAction("Chop");
sleep(1200, 1500);
}
}
}else{
if(walking.getDestination() == null || calc.distanceTo(walking.getDestination()) < random(4, 6)){
walking.walkPathMM(BanktoTrees);
return random(300, 600);
}
}
}
return random(100, 200);
}
public void onFinish() {
log("Smile: Screenshot taken!");
env.saveScreenshot(true);//TAKES A SCREENSHOT ON FINISH
}
}
And once you have change the script around you will now have your own script also i know this seems likes its not a tutorial and its just a give out but i did this so you could change it to your own thing using the instructions given in the code. i will keep posting and i will take apart the script and teach you guys the basic stuff also here is the out come
Now i will explain the coding to you so you understand it better a know whats it ment for and what it does. Well now lets start out!
Well here is what keeps the script all working to gather imports are the foundation of a script. here is what a import looks like.
Code:
import org.rsbot.script.ScriptManifest;
Script manifist is where the basic infomation about the script like version, name, discription.
Code:
@ScriptManifest(authors = { "Dead 4 Real" }, keywords = { "Woodcutting" }, name = "MyScriptName", version = 1.0, description = "Cuts willows at draynor and banks")
public class MyScriptName extends Script implements PaintListener {
Now private ints are needed for stuff like object ids and item ids so it explains its self.
Code:
private final int[] hatchetIDs = { 349, 1351, 1353, 1355, 1357, 1359, 1361, 6739 };
OnStart(); this is what happens when the script starts.
Code:
public boolean onStart() {
try {
final URL cursorURL = new URL(
"http://i48.tinypic.com/313623n.png");//MOUSE
final URL cursor80URL = new URL(
"http://i46.tinypic.com/9prjnt.png");//MOUSE CLICKED
normal = ImageIO.read(cursorURL);
clicked = ImageIO.read(cursor80URL);
} catch (MalformedURLException e) {
log("Unable to buffer cursor.");
} catch (IOException e) {
log("Unable to open cursor image.");
}
log("Start at the bank or trees.");//LOG
mouse.setSpeed(10);//MOUSE SPEED
return true;
}
Loop is what happens over and over again this is a important tool to scripting.
Code:
public int loop(){
antiban();
if(inventory.isFull()){
if(BankAre*****ntains(getMyPlayer().getLocation())){
if(!bank.isOpen()){
bank.open();
return random(500, 700);
}
bank.depositAllExcept(hatchetIDs);
if(bank.isOpen()){
bank.close();
return random(500, 700);
}
}else{
if(walking.getDestination() == null || calc.distanceTo(walking.getDestination()) < random(4, 6)){
walking.walkPathMM(TreestoBank);
return random(300, 600);
}
}
}else{
if(TreeAre*****ntains(getMyPlayer().getLocation())){
if(getMyPlayer().getAnimation() != 2846){
RSObject tree = objects.getNearest(treeIDs);
while (getMyPlayer().getAnimation() != -1)
if (!tree.isOnScreen())
camera.turnToTile(tree.getLocation());
if(tree != null){
tree.doAction("Chop");
sleep(1200, 1500);
}
}
}else{
if(walking.getDestination() == null || calc.distanceTo(walking.getDestination()) < random(4, 6)){
walking.walkPathMM(BanktoTrees);
return random(300, 600);
}
}
}
return random(100, 200);
}
OnFinish(); when it finishes script will send a log message and take a screenshot
Code:
public void onFinish() {
log("Smile: Screenshot taken!");
env.saveScreenshot(true);//TAKES A SCREENSHOT ON FINISH
}
}