Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import org.rsbot.script.Script;
- import org.rsbot.script.ScriptManifest;
- import org.rsbot.script.wrappers.RSObject;
- import org.rsbot.script.wrappers.RSTile;
- @ScriptManifest(authors = { "aaimister" }, category = "Money", name = "Potato Picker", version = 1.0, description = "<html><head></head><body><center><font size=\"6\" color=\"orange\">Potato Picker by aaimister</font></center>"
- + "<br></br>"
- + "<center><font size=\"4\" color=\"orange\">v0.1</font></center>"
- + "<br></br>"
- + "<br></br>"
- + "<center><font size=\"3\" color=\"orange\">Start script in the Draynor Village Bank. Sell at Mid to Max Price.</font></center></body></html>")
- public class Potato extends Script {
- private int potatoPlant = 312, potatoInv = 1942, pickAnimation = 827, closedGate = 45206, openGate = 45207;
- private RSTile[] toPotatos = new RSTile[] { new RSTile(3095, 3249),
- new RSTile(3108, 3254), new RSTile(3114, 3261),
- new RSTile(3124, 3263), new RSTile(3134, 3269),
- new RSTile(3134, 3282), new RSTile(3137, 3291),
- new RSTile(3145, 3292) };
- private RSTile[] toBank = new RSTile[] { new RSTile(3145, 3290),
- new RSTile(3136, 3291), new RSTile(3134, 3280),
- new RSTile(3133, 3266), new RSTile(3122, 3262),
- new RSTile(3109, 3255), new RSTile(3097, 3250),
- new RSTile(3092, 3244) };
- private enum State {
- BANK, PICK, WALK_TO_POTATO_AREA, WALK_TO_BANK, OPEN_BANK, WAIT
- }
- private State getState() {
- if (isInventoryFull()) {
- if (bank.isOpen()) {
- return State.BANK;
- } else if (distanceTo(toBank[toBank.length - 1]) <= 8) {
- return State.OPEN_BANK;
- } else {
- return State.WALK_TO_BANK;
- }
- } else {
- if (getMyPlayer().getAnimation() == pickAnimation) {
- return State.WAIT;
- } else if (distanceTo(toPotatos[toPotatos.length - 1]) <= 8) {
- return State.PICK;
- } else {
- return State.WALK_TO_POTATO_AREA;
- }
- }
- }
- public int loop() {
- setCameraAltitude(true);
- switch (getState()) {
- case BANK:
- bank.depositAll();
- wait(random(200,500));
- bank.close();
- break;
- case OPEN_BANK:
- bank.open();
- break;
- case WALK_TO_BANK:
- if (distanceTo(getDestination()) < random(5, 12)
- || distanceTo(getDestination()) > 40) {
- if (!walkPathMM(toBank)) {
- walkToClosestTile(toBank);
- }
- }
- break;
- case PICK:
- RSObject potato = getNearestObjectByID(potatoPlant);
- if(potato != null) {
- atObject(potato, "Pick");
- return (random(200, 300));
- }
- case WALK_TO_POTATO_AREA:
- if (distanceTo(getDestination()) < random(5, 12)
- || distanceTo(getDestination()) > 40) {
- if (!walkPathMM(toPotatos)) {
- walkToClosestTile(toBank);
- }
- }
- break;
- case WAIT:
- break;
- }
- return random(350, 650);
- }
- }
Add Comment
Please, Sign In to add comment