• Log in or sign up for an account here: https://www.sythe.org/login

My First Bot

agiledice

Active Member
Banned
Joined
Sep 25, 2011
Sythe Gold
0
Messages
140
Location
North Carolina
My First Bot
Since botany bay just came out I thought it would be good to get into the botting industry now that fewer people do it. I have never used a bot (made my me or not) until two days ago. With very little java programming knowledge (zero experience with robot class) I wrote this superheating bot that seems like a success. I ran it last night successfully for 6 hours. It simply clicks in the right place at the right time. It doesn't use color except to check if a certain spot on the minimap is mostly red. This is meant to run at north west varrock west bank and it is making sure it is there by looking for the red arrow that goes down the bank stairs. If this is the wrong place, feel free to move, just wanted to share what I created. I haven't seen anything similar on here, but if there is I would like to see look at it and maybe learn more.

Code:
package one;
import java.awt.AWTException;
import java.awt.Color;
import java.awt.Robot;
import java.awt.event.InputEvent;
import java.util.Random;
public class Action {
	public static void main(String[] args) throws AWTException {
	Robot robot=new Robot();
	int x=20;
	int y=20;
	int count=0;
	int count2=0;
	int antiban=0;
	int antiban2=10;
	int red=0;
	int pixelx=0;
	int blue=0;
	int blue2=0;
	int bluecount=0;
	int t=0;
	Random ranban= new Random();
	Random rant= new Random();
	Random ranx= new Random();
	Random rany= new Random();
	robot.delay(10000);
	//waits 10 seconds to start
	for(count2=0;count2<2000;count2+=1){
		Color color = robot.getPixelColor(712, 328);
		red=color.getRed();
		if(red<200){
		t=1000;
		robot.delay(t);
		robot.mouseMove(860, 260);
		robot.mousePress(InputEvent.BUTTON1_MASK);
        robot.mouseRelease(InputEvent.BUTTON1_MASK);
        robot.delay(t);
		}
		//checks to see if on magic tab
	x=ranx.nextInt(7)+346;
	y=rany.nextInt(7)+231;
	robot.mouseMove(x,y);
	t=rant.nextInt(100)+500;
    robot.delay(t);
		for(pixelx=220;pixelx<250;pixelx+=1){
		Color color2=robot.getPixelColor(pixelx, 90);
		blue=color2.getBlue();
			if(blue>200){
			bluecount+=1;
			}
		}
		//checks if bank is one west
	if(bluecount<1){
		x=ranx.nextInt(5)+870;
		y=rany.nextInt(5)+75;
    	robot.mouseMove(x,y);
		robot.mousePress(InputEvent.BUTTON1_MASK);
        robot.mouseRelease(InputEvent.BUTTON1_MASK);
        x=ranx.nextInt(10)+755;
    	y=rany.nextInt(20)+460;
		robot.mouseMove(755,460);
		robot.mousePress(InputEvent.BUTTON1_MASK);
        robot.mouseRelease(InputEvent.BUTTON1_MASK);
        System.exit(0); 
		}
	bluecount=0;
	robot.mousePress(InputEvent.BUTTON1_MASK);
    robot.mouseRelease(InputEvent.BUTTON1_MASK);
    //clicks on bank
    t=rant.nextInt(200)+1500;
    robot.delay(t);
    x=ranx.nextInt(15)+480;
	y=rany.nextInt(10)+370;
	robot.mouseMove(x,y);
	t=rant.nextInt(100)+400;
    robot.delay(t);
    Color color3=robot.getPixelColor(490, 375);
	blue2=color3.getBlue();
		if(blue2>160){
			t=rant.nextInt(2000)+3000;
		    robot.delay(t);
		}
		//sees if blue rug is showing due to lagg
		//if so, waits a bit
	robot.mousePress(InputEvent.BUTTON1_MASK);
    robot.mouseRelease(InputEvent.BUTTON1_MASK);
    //clicks bank all
    t=rant.nextInt(100)+500;
    robot.delay(t);
    x=ranx.nextInt(20)+560;
	y=rany.nextInt(15)+165;
	robot.mouseMove(x,y);
	t=rant.nextInt(50)+200;
    robot.delay(t);
	robot.mousePress(InputEvent.BUTTON3_MASK);
    robot.mouseRelease(InputEvent.BUTTON3_MASK);
    //rightclicks ore
    t=rant.nextInt(100)+500;
    robot.delay(t);
    x=ranx.nextInt(25)+555;
	y+=78+rany.nextInt(3);
	robot.mouseMove(x,y);
	t=rant.nextInt(100)+500;
    robot.delay(t);
	robot.mousePress(InputEvent.BUTTON1_MASK);
    robot.mouseRelease(InputEvent.BUTTON1_MASK);
    //withdraws ore
    t=rant.nextInt(100)+500;
    robot.delay(t);
    x=ranx.nextInt(25)+515;
	y=rany.nextInt(15)+170;
	robot.mouseMove(x,y);
	t=rant.nextInt(100)+500;
    robot.delay(t);
	robot.mousePress(InputEvent.BUTTON3_MASK);
    robot.mouseRelease(InputEvent.BUTTON3_MASK);
    //right clicks coal
    t=rant.nextInt(100)+500;
    robot.delay(t);
    x=ranx.nextInt(20)+515;
	y=rany.nextInt(7)+290;
	robot.mouseMove(x,y);
	robot.mousePress(InputEvent.BUTTON1_MASK);
    robot.mouseRelease(InputEvent.BUTTON1_MASK);
    t=rant.nextInt(100)+500;
    robot.delay(t);
    //clicks withdraw all coal
    t=rant.nextInt(100)+200;
    robot.delay(t);
    x=ranx.nextInt(10)+605;
	y=rany.nextInt(12)+100;
	robot.mouseMove(x,y);
	t=rant.nextInt(100)+500;
    robot.delay(t);
	robot.mousePress(InputEvent.BUTTON1_MASK);
    robot.mouseRelease(InputEvent.BUTTON1_MASK);
    //closes bank
    x=ranx.nextInt(5)+713;
	y=rany.nextInt(5)+325;
	robot.mouseMove(x,y);
	//moves to superheat
	t=rant.nextInt(200)+700;
    robot.delay(t);
	count=0;
    for(count=0;count<5;count+=1){
    	x=ranx.nextInt(5)+713;
    	y=rany.nextInt(5)+325;
    	robot.mouseMove(x,y);
    	robot.mousePress(InputEvent.BUTTON1_MASK);
        robot.mouseRelease(InputEvent.BUTTON1_MASK);
        t=rant.nextInt(200);
        robot.delay(t);
        robot.mousePress(InputEvent.BUTTON1_MASK);
        robot.mouseRelease(InputEvent.BUTTON1_MASK);
        t=rant.nextInt(200)+1200;
        robot.delay(t);
        //clicks superheat 5 times
    	}
    antiban+=1;
    	if(antiban>antiban2){
    	x=ranx.nextInt(15)+710;
        y=rany.nextInt(15)+245;
        robot.mouseMove(x,y);
        t=rant.nextInt(100)+500;
        robot.delay(t);
        robot.mousePress(InputEvent.BUTTON1_MASK);
        robot.mouseRelease(InputEvent.BUTTON1_MASK);
        t=rant.nextInt(100)+500;
        robot.delay(t);
        x=ranx.nextInt(15)+800;
        y=rany.nextInt(15)+310;
        robot.mouseMove(x,y);
        t=rant.nextInt(2000)+3000;
        robot.delay(t);
        x=ranx.nextInt(15)+855;
        y=rany.nextInt(15)+250;
        robot.mouseMove(x,y);
        t=rant.nextInt(100)+500;
        robot.delay(t);
        robot.mousePress(InputEvent.BUTTON1_MASK);
        robot.mouseRelease(InputEvent.BUTTON1_MASK);
        t=rant.nextInt(200)+500;
        robot.delay(t);
        antiban2=ranban.nextInt(10)+15;
        antiban=0;
    	}
    	//occasionally looks at smithing xp
    }	
}
}
 
My First Bot
Looks good for your first script, but you can still improve loads even if you are just using your own Robot stuff and not an actual client. You should add a picture of your bank setup and player setup as this wouldn't work otherwise as far as I can judge from quickly looking over the code.
 
My First Bot
Code:
robot.mouseMove(662, 90);

t=2000;
robot.delay(t);

oh sorry, I didn't see these lines which are clearly very random.
 
My First Bot
Nice work, however if something were to happen that shouldn't normally then your program wouldn't correct itself, you should look into scripting for a client as this uses your mouse.
 
My First Bot
Saw some flaws here and there. Overall, the whole script was pretty good.
I made my first one back in 09 I think.
 
Runescape Gamblingrunescape gambling
Back
Top