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

Make a Bot

Dial

Experienced Web Developer

$200 USD Donor New
Pirate
PHP Programmers
Joined
Jul 12, 2010
Sythe Gold
126
Messages
5,739
Sythe's 10th Anniversary
Two Factor Authentication User
MushyMuncher
Member of the Month Winner
Easter 2015
Discord Verified
Can someone perhaps edit this script to make a white berry gathering script?

Code:
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Point;

import org.rsbot.event.events.ServerMessageEvent;
import org.rsbot.event.listeners.PaintListener;
import org.rsbot.event.listeners.ServerMessageListener;
import org.rsbot.script.ScriptManifest;
import org.rsbot.script.Script;
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 = { "iPhQ" }, keywords = { "Money Making" }, name = "iPhQ's Swamp Toad Picker", version = 0.1, description = "Not recommended for skillers")
public class SwampToad extends Script implements PaintListener, ServerMessageListener {

	private int SWAMP_TOAD_ID = 2150;
	private int BANK_LADDER_UP_ID = 1742;
	private int BANK_LADDER_DOWN_ID = 1744;
	private int BANK_ID = 2213;

	public final RSTile BANK_LADDER_UP_WALK_TILE = new RSTile(2443, 3435);
	public final RSTile BANK_TILE = new RSTile(2445, 3423);
	public final RSTile SHIT_LOCATION = new RSTile(2423, 3507);
	public final RSTile LADDER_DOWN_LOCATION = new RSTile(2445, 3433);
	public final RSTile TURN_TO = new RSTile(2417, 3514);

	public final RSArea SWAMP_AREA = new RSArea(new RSTile(2406, 3519),
			new RSTile(2431, 3505));
	public final RSArea BANK_LADDER_AREA = new RSArea(new RSTile(2442, 3437),
			new RSTile(2447, 3432));

	private String STATUS = "N/A";
	private int TOADS_DEPOSITED = 0;
	private int TOADS_PRICE;
	public long startTime = System.currentTimeMillis();
	
	private int PICKED_UP = 0;
	private int TOTAL = 0;
	
	public boolean onStart() {
		TOADS_PRICE = this.grandExchange.getMarketPrice(SWAMP_TOAD_ID);
		log("OMG SWAMP TOADS ARE " + TOADS_PRICE
				+ "$$$$ EACH ! THATS SOO CHEAP ");
		log("PLS SELL AT mid-max TO MAKE THEM EXPENsIVE PLS");
		startTime = System.currentTimeMillis();
		return true;
	}

	public int loop() {
		switch (getStatus()) {
		case BANK:
			antiBan(300);
			STATUS = "Banking";
			if (this.game.getPlane() == 0) {
				walking.walkTileMM(walking
						.getClosestTileOnMap(this.BANK_LADDER_AREA
								.getCentralTile()), 1, 1);
				sleep(random(1500, 2000));
				RSObject BANK_LADDER_UP = objects.getNearest(BANK_LADDER_UP_ID);
				if (BANK_LADDER_UP != null
						&& BANK_LADDER_AREA.contains(players.getMyPlayer()
								.getLocation())) {
					BANK_LADDER_UP.doAction("Climb-up");
					sleep(2500, 3500);
				}
			}
			if (this.game.getPlane() == 1) {
				walking.walkTileMM(walking.getClosestTileOnMap(this.BANK_TILE),
						1, 1);
				sleep(2500, 4500);
				RSObject BANK_OBJECT = objects.getNearest(BANK_ID);
				BANK_OBJECT.doAction("Use-quickly");
				sleep(2500, 5500);
				TOADS_DEPOSITED += inventory.getCount(SWAMP_TOAD_ID);
				bank.depositAll();
				return random(2500, 5500);
			}
			break;

		case WALK_TO_DA_SHIT:
			antiBan(300);
			STATUS = "Walking to Swamp";
			if (this.game.getPlane() == 1) {
				walking.walkTileMM(
						walking.getClosestTileOnMap(this.LADDER_DOWN_LOCATION),
						1, 1);
				sleep(1500, 3000);
				RSObject BANK_LADDER_DOWN = objects
						.getNearest(BANK_LADDER_DOWN_ID);
				if (BANK_LADDER_DOWN != null) {
					BANK_LADDER_DOWN.doAction("Climb-down");
					sleep(500, 1500);
				}
			}
			walking.walkTileMM(walking.getClosestTileOnMap(this.SHIT_LOCATION),
					1, 1);
			sleep(500, 1000);
			break;

		case PICK_THE_SHIT:
			int last = inventory.getCount(this.SWAMP_TOAD_ID);
			
			antiBan(300);
			STATUS = "Picking Swamp Toads";
			if (!this.groundItems.getNearest(SWAMP_TOAD_ID).isOnScreen()) {
				walking.walkTileMM(
						walking.getClosestTileOnMap(groundItems.getNearest(
								SWAMP_TOAD_ID).getLocation()), 1, 1);
			}
			if (walking.getEnergy() > 25) {
				walking.setRun(true);
			}
			this.groundItems.getNearest(this.SWAMP_TOAD_ID).doAction("Take");
			int count = inventory.getCount(SWAMP_TOAD_ID);
			count -= last = PICKED_UP;
			TOTAL = PICKED_UP + TOTAL;
			sleep(500, 1000);
			
			break;
		case WAITING_FOR_LOGIN:
			STATUS = "N/A";
			this.sleep(5000);
			break;
		}
		return random(100, 700);
	}

	public void onFinish() {
		log("Thank you for using this script!");
		log("Don't be shy... Post the bugs at http://www.powerbot.org/vb/showthread.php?t=495516&p=5260857#post5260857");
	}

	// START: Code generated using Enfilade's Easel
	private final Color color1 = new Color(153, 255, 153);
	private final Color color2 = new Color(0, 0, 0);

	private final BasicStroke stroke1 = new BasicStroke(1);

	private final Font font1 = new Font("Bookman Old Style", 0, 13);

	public void onRepaint(Graphics g1) {
		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;
		long minutes2 = minutes + (hours * 60);

		Graphics2D g = (Graphics2D) g1;
		g.setColor(color1);
		g.fillRoundRect(6, 264, 210, 71, 16, 16);
		g.setColor(color2);
		g.setStroke(stroke1);
		g.drawRoundRect(6, 264, 210, 71, 16, 16);
		g.setFont(font1);
		g.drawString("Time running: " + hours + ":" + minutes + ":" + seconds
				+ "", 15, 298);
		g.drawString("Toads Banked: " + TOTAL , 15, 312);
		g.drawString("Money Gained: " + TOADS_PRICE * TOTAL, 15, 326);
		g.drawString("Status: " + STATUS, 15, 282);
	}

	// END: Code generated using Enfilade's Easel

	// ---------------- METHODS -------------- //

	private enum Status {
		WAITING_FOR_LOGIN, BANK, WALK_TO_DA_SHIT, PICK_THE_SHIT;
	}

	private Status getStatus() {
		if (inventory.getCountExcept(this.SWAMP_TOAD_ID) != 0
				&& inventory.isFull()) {
			return Status.BANK;
		} else if (inventory.getCountExcept(SWAMP_TOAD_ID) == 0
				&& !inventory.isFull()
				&& !SWAMP_AREA.contains(players.getMyPlayer().getLocation())) {
			return Status.WALK_TO_DA_SHIT;
		} else if (!inventory.isFull()) {
			return Status.PICK_THE_SHIT;
		} else if (this.inventory.getCount() == 28) {
			return Status.BANK;
		}
		return Status.WAITING_FOR_LOGIN;
	}

	public void antiBan(int id) {
		final int rand = random(0, id);
		
		if (rand == 0) {
			rotateCamera();
		} else if (rand < 1) {
			waveMouse();
		}else if (rand == 2) {
			if (game.getCurrentTab() != Game.TAB_STATS) {
				game.openTab(Game.TAB_STATS);
				sleep(random(200, 400));
				interfaces.getComponent(Skills.INTERFACE_TAB_STATS, Skills.INTERFACE_CRAFTING).doHover();
				sleep(random(800, 1500));
				if (random(0, 2) == 0) {
					moveMouseAway(10);
				}
				sleep(random(200, 400));
			}
		}else if (rand == 3) {
			if (game.getCurrentTab() != Game.TAB_STATS) {
				game.openTab(Game.TAB_STATS);
				sleep(random(200, 400));
				interfaces.getComponent(Skills.INTERFACE_TAB_STATS, Skills.INTERFACE_WOODCUTTING).doHover();
				sleep(random(800, 1500));
				if (random(0, 2) == 0) {
					moveMouseAway(10);
				}
				sleep(random(200, 400));
			}
		}else if (rand == 4) {
			if (game.getCurrentTab() != Game.TAB_STATS) {
				game.openTab(Game.TAB_STATS);
				sleep(random(200, 400));
				interfaces.getComponent(Skills.INTERFACE_TAB_STATS, Skills.INTERFACE_FLETCHING).doHover();
				sleep(random(800, 1500));
				if (random(0, 2) == 0) {
					moveMouseAway(10);
				}
				sleep(random(200, 400));
			}
		}else if (rand == 5) {
			if (game.getCurrentTab() != Game.TAB_STATS) {
				game.openTab(Game.TAB_STATS);
				sleep(random(200, 400));
				interfaces.getComponent(Skills.INTERFACE_TAB_STATS, Skills.INTERFACE_COOKING).doHover();
				sleep(random(800, 1500));
				if (random(0, 2) == 0) {
					moveMouseAway(10);
				}
				sleep(random(200, 400));
			}
		}else if (rand == 6) {
			if (game.getCurrentTab() != Game.TAB_STATS) {
				game.openTab(Game.TAB_STATS);
				sleep(random(200, 400));
				interfaces.getComponent(Skills.INTERFACE_TAB_STATS, Skills.INTERFACE_FLETCHING).doHover();
				sleep(random(800, 1500));
				if (random(0, 2) == 0) {
					moveMouseAway(10);
				}
				sleep(random(200, 400));
			}
		}else if(rand == 7){
			if (game.getCurrentTab() != Game.TAB_INVENTORY) {
				game.openTab(Game.TAB_INVENTORY);
			}
		}
		else if(rand == 8){
			if (game.getCurrentTab() != Game.TAB_INVENTORY) {
				game.openTab(Game.TAB_INVENTORY);
			}
		}
		else if(rand == 9){
			if (game.getCurrentTab() != Game.TAB_INVENTORY) {
				game.openTab(Game.TAB_INVENTORY);
			}
		}
		else if(rand == 10){
			if (game.getCurrentTab() != Game.TAB_INVENTORY) {
				game.openTab(Game.TAB_INVENTORY);
			}
		}
		else if(rand == 11){
			if (game.getCurrentTab() != Game.TAB_INVENTORY) {
				game.openTab(Game.TAB_INVENTORY);
			}
		}
		else if(rand == 12){
			if (game.getCurrentTab() != Game.TAB_INVENTORY) {
				game.openTab(Game.TAB_INVENTORY);
			}
		}
		else if(rand == 13){
			if (game.getCurrentTab() != Game.TAB_INVENTORY) {
				game.openTab(Game.TAB_INVENTORY);
			}
		}
		
	}
	
	private void moveMouseAway(final int moveDist) {
		final Point pos = mouse.getLocation();
		mouse.move(pos.x - moveDist, pos.y - moveDist, moveDist * 2,
				moveDist * 2);
	}
	
	private void rotateCamera() {
		int angle = camera.getAngle() + random(-40, 40);
		if (angle < 0) {
			angle += 359;
		}
		if (angle > 359) {
			angle -= 359;
		}

		camera.setAngle(angle);
	}
	
	private void waveMouse() {
		final Point curPos = mouse.getLocation();
		mouse.move(random(0, 750), random(0, 500), 20);
		sleep(random(100, 300));
		mouse.move(curPos, 20, 20);
	}

	@Override
	public void serverMessageRecieved(ServerMessageEvent e) {
		// TODO Auto-generated method stub
		
	}

}

This script is a swamp toad collector.

I want the white berry bot to start at the Wilderness Volcano, run north to the red dragon area (avoiding the dragons by going a certain route), and collect the white berries. Once it has a full inventory, run back to the wilderness volcano and repeat.

If you die, then I want it to go to Falador bank and get out a games necklace and teleport back to the volcano, and repeat the steps above.

Can anyone do this? I'd maybe pay. I'd also like to be the only one to use it for a little while (I'd pay). I just need some quick cash, and I'd rather not have prices drop. :p
 
Hold on, I'll try.

EDIT: It'd be better off starting from scratch.
 
Runescape Gamblingrunescape gambling
Back
Top