1jonathan 0 Posted July 9, 2016 Greetings! looking for someone to make this script or to give me some script snippets witch i can use myself to make it.Any kind of loot and bank script would work i think. I just have to change the area and the name of the object to make it work.I want to pick up raw chickens in the farm north of Lumbridge. I see alot of players killing the chickens and not looting them and want to take advantage of that. I could not find a script like this on the forum so i will try my luck here.Thanks in advance!
zeepzoop 3 Posted July 9, 2016 give me 30 min import org.dreambot.api.methods.Calculations;import org.dreambot.api.methods.map.Area;import org.dreambot.api.script.AbstractScript;import org.dreambot.api.script.Category;import org.dreambot.api.script.ScriptManifest;import org.dreambot.api.wrappers.interactive.GameObject;import org.dreambot.api.wrappers.items.GroundItem;/*** Created by zeepzoop on 7/9/16.*/@ScriptManifest(name = "chickenshit", category = Category.MISC, author = "zeepzoop", version = 0.1)public class Main extends AbstractScript{private final Area BANK_AREA = new Area(3208, 3220, 3210, 3218, 2);private final Area CHICKEN_AREA = new Area(3171, 3301, 3184, 3291);private final Area STAIR_AREA = new Area(3206, 3228, 3210, 3227);private enum State{PICKUP, WALK_TO_BANK, BANK, WALK_TO_CHICKEN}@Overridepublic void onStart(){log("onStart, start");}@Overridepublic int onLoop() {log("onLoop, start");switch (getState()){case PICKUP:return pickUp();case WALK_TO_BANK:return walkToBank();case BANK:return bank();case WALK_TO_CHICKEN:return walkToChicken();default:log("onLoop, default");}return 0;}private State getState() {if (getInventory().isFull() || getBank().isOpen()) {if (BANK_AREA.contains(getLocalPlayer())) {return State.BANK;} else {return State.WALK_TO_BANK;}} else {if (CHICKEN_AREA.contains(getLocalPlayer())) {return State.PICKUP;} else {return State.WALK_TO_CHICKEN;}}}private int pickUp(){GroundItem rawChicken = getGroundItems().closest(groundItem -> groundItem != null && groundItem.getName().equals("Raw chicken") && groundItem.distance() < 20);if(rawChicken != null){rawChicken.interact("Take");sleepUntil(() -> !getLocalPlayer().isMoving(), 4000);return Calculations.random(200, 500);}else{log("pickUp, rawChicken is null");return Calculations.random(3000, 10000);}}private int walkToBank(){if(getLocalPlayer().getZ() != 2){if(STAIR_AREA.contains(getLocalPlayer()) || getLocalPlayer().getZ() == 1){GameObject stair = getGameObjects().closest(gameObject -> gameObject != null && gameObject.getName().equals("Staircase") && gameObject.hasAction("Climb-up"));if(stair != null){stair.interact("Climb-up");}else{log("walkToBank, stair is null");}return Calculations.random(1000, 3000);}else{if(getWalking().walk(STAIR_AREA.getRandomTile())){log("walkToBank, success");}else{log("walkToBank, fail");}return Calculations.random(1000, 2000);}}else if(getLocalPlayer().getZ() == 2){if(getWalking().walk(BANK_AREA.getRandomTile()));return Calculations.random(1000, 2000);}else{log("walkToBank, error");return Calculations.random(5000, 10000);}}private int bank(){if(getBank().isOpen()){if(getInventory().isEmpty()){getBank().close();}else{getBank().depositAllItems();}return Calculations.random(3000, 5000);}else{getBank().open();return Calculations.random(3000, 5000);}}private int walkToChicken(){if(getLocalPlayer().getZ() != 0){GameObject stair = getGameObjects().closest(gameObject -> gameObject != null && gameObject.getName().equals("Staircase") && gameObject.hasAction("Climb-down"));if(stair.distance() > 5){getWalking().walk(stair.getTile().translate(Calculations.random(-2, 2), Calculations.random(-2, 2)));return Calculations.random(1000, 3000);}if(stair != null){stair.interact("Climb-down");}else{log("walkToBank, stair is null");}}else{getWalking().walk(CHICKEN_AREA.getRandomTile());}return Calculations.random(1000, 3000);}} very bare-bones, you should modify timings/sleeps
Recommended Posts
Archived
This topic is now archived and is closed to further replies.