import org.rsbot.script.Script; import org.rsbot.script.ScriptManifest; import org.rsbot.script.util.Filter; import org.rsbot.script.util.Timer; import org.rsbot.script.wrappers.RSArea; import org.rsbot.script.wrappers.RSGroundItem; import org.rsbot.script.wrappers.RSItem; import org.rsbot.script.wrappers.RSNPC; import org.rsbot.script.wrappers.RSObject; import org.rsbot.script.wrappers.RSPath; import org.rsbot.script.wrappers.RSTile; import org.rsbot.script.wrappers.RSTilePath; import org.rsbot.script.methods.Equipment; import org.rsbot.script.methods.Interfaces; import org.rsbot.script.methods.Skills; import org.rsbot.script.methods.Store; @ScriptManifest(name = "Cacti", authors = "Huupderitis", keywords = "potato, cacti, a", version = 1.0, description = "This will RoD to and from potato cacti 2k each :D") public class cacti extends Script { private final RSTile[] toHole = {new RSTile(3298,3107), new RSTile(3288,3104),new RSTile(3276,3106), new RSTile(3265,3109), new RSTile(3255,3103), new RSTile(3239,3104), new RSTile(3229,3109)}; private final RSTile safety = (new RSTile(3460,9484)); private final RSTile[] toCactus = {new RSTile(3472,9517), new RSTile(3474,9502), new RSTile(3467,9489), new RSTile(3460,9484)}; public int cactus = 3138; public int food = 379; public int potion = 2446; public int ring = 2552; public int vial = 229; private boolean atPass(){ RSObject gate = objects.getNearest(35543); if (gate !=null){ return true;} return false; } ////need to check this for y = 9000 just in case :/ private boolean through(){ if (getMyPlayer().getLocation().getY() <= 3116){ return true; } return false; } private boolean atCactus(){ RSArea area = new RSArea(new RSTile(3459,9472), new RSTile(3472,9492)); return (area.contains(getMyPlayer().getLocation())); } private boolean inLair(){ if (getMyPlayer().getLocation().getY() >=8500){ return true; } return false; } private boolean atWell(){ RSObject well = (objects.getNearest(48802)); if (well !=null){ if (calc.distanceTo(well) <=5 || well.isOnScreen()){ return true; } } return false; } private boolean partOne(){ RSArea one = new RSArea(new RSTile(3482,9507), new RSTile(3487,9512)); return(one.contains(getMyPlayer().getLocation())); } public void bank(){ if (objects.getNearest(2693) !=null){ if (objects.getNearest(2693).isOnScreen()){ objects.getNearest(2693).doAction("Open"); sleep(1500,2000); } if (bank.isOpen() && !inventory.contains(cactus)){ bank.withdraw(food, 10); sleep(1200,1500); bank.withdraw(potion,2); sleep(1200,1500); } if (bank.isOpen() && inventory.contains(cactus)){ bank.depositAll(); sleep(500,1000); } if (bank.isOpen() && inventory.contains(food) && inventory.getCount(food) == 10 && inventory.contains(potion)){ bank.close(); sleep(1000,1500); } } } public void bankR(){ if (objects.getNearest(2693) !=null){ if (objects.getNearest(2693).isOnScreen()){ objects.getNearest(2693).doAction("Open"); sleep(1500,2000); } if (bank.isOpen() && !inventory.contains(cactus)){ bank.withdraw(food, 10); sleep(1200,1500); bank.withdraw(potion,2); sleep(1200,1500); bank.withdraw(ring, 1); sleep(1200,1500); } if (bank.isOpen() && inventory.contains(cactus)){ bank.depositAll(); sleep(500,1000); } if (bank.isOpen() && inventory.contains(food) && inventory.getCount(food) == 10 && inventory.contains(potion) && inventory.contains(ring)){ inventory.getItem(ring).doAction("Wear"); sleep(1000,1200); bank.close(); sleep(1000,1500); } } } public void doPass(){ if (atPass() && inventory.contains(food) && inventory.getCount(food)==10 && !through()){ RSObject pass = (objects.getNearest(35543)); if (pass !=null && pass.isOnScreen() && !getMyPlayer().isMoving() && !interfaces.get(243).isValid() && !interfaces.get(236).isValid() && !interfaces.get(64).isValid()){ pass.doAction("Go-through"); sleep(500,1000);} if (interfaces.get(243).isValid()){ sleep(400,650); interfaces.getComponent(243, 7).doClick(); sleep(200,400); } if (interfaces.get(236).isValid()){ sleep(500,650); interfaces.getComponent(236, 1).doClick(); sleep(200,400); } if (interfaces.get(64).isValid()){ sleep(400,700); interfaces.getComponent(64, 5).doClick(); sleep(200,400); } } else { RSObject pass = (objects.getNearest(35543)); if (pass !=null && !pass.isOnScreen()){ camera.turnTo(pass, 0); } } } public void pick(){ if (!inventory.isFull() && atCactus()) { if (groundItems.getNearest(cactus) !=null){ if (groundItems.getNearest(cactus).isOnScreen()){ groundItems.getNearest(cactus).doAction("Take"); sleep(400,500); } if (!groundItems.getNearest(cactus).isOnScreen()){ walking.walkTileMM(groundItems.getNearest(cactus).getLocation(), 2, 2); sleep(500,700); } } if (groundItems.getNearest(cactus) == null){ walking.walkTileMM(safety); sleep(1000,1300); } } if (inventory.isFull() && atCactus()){ if (groundItems.getNearest(cactus) == null){ walking.walkTileMM(safety); sleep(1000,1300); } if (inventory.contains(vial)){ inventory.dropItem(vial, 1); sleep(500); } if (inventory.contains(food)){ inventory.getItem(food).doAction("Eat"); sleep(500,700); } } } public void teleport(){ if (atCactus() && !inventory.contains(food)){ equipment.getItem(Equipment.RING).doAction("Duel Arena"); sleep(500,1000); } } private void smoothWalk (RSTile[] path) { for (int i = 0; i < path.length; i++) { RSTile var = path[i]; if(calc.distanceTo(var) >= 5){ walking.walkTileMM(var,2,3); while(calc.distanceTo(var) >= 5) sleep(random(100,1000)); } } } public boolean onStart() { return true; } @Override public int loop() { mouse.setSpeed(random(7,8)); if (getMyPlayer().getHPPercent() < 65){ inventory.getItem(food).doAction("Eat"); } if (combat.isPoisoned() && combat.getHealth() <=620){ inventory.getItem(potion).doAction("Drink"); } if (atPass() && inventory.getCount(food) != 10 && !through()){ if (equipment.getItem(Equipment.RING)==null){ bankR();} } else { if (atPass() && inventory.getCount(food) !=10 && !through()){ if(equipment.getItem(Equipment.RING) !=null){ bank(); } } } if (atPass() && !through() && inventory.contains(food) && inventory.getCount(food) == 10 && inventory.contains(potion) && !bank.isOpen()){ doPass(); } if (through() && !atWell()){ smoothWalk(toHole); } if (atWell()){ objects.getNearest(48802).doAction("Climb-down"); sleep(1500,1600); } if (partOne() && !atCactus() && inventory.contains(food) ){ sleep(random(400,500)); walking.walkTileMM(new RSTile(3485,9501),2,1); sleep(500); } if (getMyPlayer().isMoving() && !atCactus() && inLair()){ while(getMyPlayer().isMoving()){ sleep(random(1500,2000)); } } if (atCactus() && inventory.contains(food)){ pick(); } if (atCactus() && !inventory.contains(food)){ teleport(); } return (random(300,400)); } public void onFinish(){ } }