Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.Graphics;
- 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.utilities.Timer;
- import org.dreambot.api.wrappers.interactive.GameObject;
- @ScriptManifest(author = "Pug", name = "Pug cutter", version = 0.01, description = "1", category = Category.WOODCUTTING)
- public class cutter extends AbstractScript
- {
- Area treeArea = new Area(2946, 3240, 2955, 3229);
- private Timer timer;
- private String log = "Starting up";
- private void chopTree(String nameOfTree){
- GameObject tree = getGameObjects().closest(gameObject -> gameObject != null && gameObject.getName().equals(nameOfTree));
- if(tree != null && tree.interact("Chop down")){
- int countLog = getInventory().count("Logs");
- sleepUntil(() -> getInventory().count("Logs") > countLog, 12000);
- }
- }
- public void onStart()
- {
- timer = new Timer();
- }
- @Override
- public int onLoop()
- {
- if(getLocalPlayer().getAnimation() != -1)
- {
- log = "Animating";
- sleep(600);
- }
- if(!getInventory().isFull())
- {
- if(treeArea.contains(getLocalPlayer()))
- {
- log = "going to cut / cutting";
- chopTree("Tree"); //change "Tree" to the name of your tree.
- sleep(600);
- getMouse().moveMouseOutsideScreen();
- while(getLocalPlayer().getAnimation() != -1)
- {
- log = "cutting";
- sleep(300);
- }
- }
- else
- {
- if(getWalking().walk(treeArea.getRandomTile()))
- {
- log = "going to trees";
- sleep(Calculations.random(1000, 2500));
- }
- }
- }
- if(getInventory().isFull())
- {
- log = "dropping";
- getInventory().dropAll();
- sleep(600);
- while(getInventory().isFull())
- {
- sleep(300);
- }
- }
- return Calculations.random(200,400);
- }
- public void onPaint(Graphics g)
- {
- g.drawString("Timer: " + timer.formatTime(), 20, 200);
- g.drawString("action: " + log, 20, 220);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement