Guest User

Pug Cutter Basicsss

a guest
Aug 1st, 2015
397
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.awt.Graphics;
  2.  
  3. import org.dreambot.api.methods.Calculations;
  4. import org.dreambot.api.methods.map.Area;
  5. import org.dreambot.api.script.AbstractScript;
  6. import org.dreambot.api.script.Category;
  7. import org.dreambot.api.script.ScriptManifest;
  8. import org.dreambot.api.utilities.Timer;
  9. import org.dreambot.api.wrappers.interactive.GameObject;
  10.  
  11.  
  12. @ScriptManifest(author = "Pug", name = "Pug cutter", version = 0.01, description = "1", category = Category.WOODCUTTING)
  13. public class cutter extends AbstractScript
  14. {
  15.      Area treeArea = new Area(2946, 3240, 2955, 3229);
  16.      private Timer timer;
  17.      private String log = "Starting up";
  18.    
  19.     private void chopTree(String nameOfTree){
  20.         GameObject tree = getGameObjects().closest(gameObject -> gameObject != null && gameObject.getName().equals(nameOfTree));
  21.         if(tree != null && tree.interact("Chop down")){
  22.             int countLog = getInventory().count("Logs");
  23.             sleepUntil(() -> getInventory().count("Logs") > countLog, 12000);
  24.         }
  25.     }
  26.  
  27.     public void onStart()
  28.     {
  29.         timer = new Timer();
  30.     }
  31.    
  32.     @Override
  33.     public int onLoop()
  34.     {
  35.         if(getLocalPlayer().getAnimation() != -1)
  36.         {
  37.             log = "Animating";
  38.             sleep(600);
  39.         }
  40.         if(!getInventory().isFull())
  41.         {
  42.             if(treeArea.contains(getLocalPlayer()))
  43.             {
  44.                 log = "going to cut / cutting";
  45.                 chopTree("Tree"); //change "Tree" to the name of your tree.
  46.                 sleep(600);
  47.                 getMouse().moveMouseOutsideScreen();
  48.                 while(getLocalPlayer().getAnimation() != -1)
  49.                 {
  50.                     log = "cutting";
  51.                     sleep(300);
  52.                 }
  53.             }
  54.             else
  55.             {
  56.                 if(getWalking().walk(treeArea.getRandomTile()))
  57.                 {
  58.                     log = "going to trees";
  59.                     sleep(Calculations.random(1000, 2500));
  60.                 }
  61.             }
  62.         }
  63.        
  64.         if(getInventory().isFull())
  65.         {
  66.             log = "dropping";
  67.             getInventory().dropAll();
  68.             sleep(600);
  69.             while(getInventory().isFull())
  70.             {
  71.                 sleep(300);
  72.             }
  73.         }
  74.        
  75.        
  76.        
  77.         return Calculations.random(200,400);
  78.     }
  79.    
  80.     public void onPaint(Graphics g)
  81.     {
  82.         g.drawString("Timer: " + timer.formatTime(), 20, 200);
  83.         g.drawString("action: " + log, 20, 220);
  84.     }
  85. }
RAW Paste Data