Guest User

Untitled

a guest
Jan 21st, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import org.rsbot.script.Script;
  2. import org.rsbot.script.ScriptManifest;
  3. import org.rsbot.script.wrappers.RSObject;
  4. import java.awt.*;
  5. import org.rsbot.event.listeners.PaintListener;
  6.  
  7. @ScriptManifest(authors = "Zh3", description = "First Script! Cuts Willows!", keywords = "woodcutting", name = "ZhChop", version = 1.00)
  8. public class ZhChopper extends Script implements PaintListener {
  9.  
  10.     @Override
  11.     public boolean onStart() {
  12.         log("Welcome To My First Script! ZhChop");
  13.         return game.isLoggedIn();
  14.     }
  15.  
  16.     // What it will say when the script is stopped !
  17.     @Override
  18.     public void onFinish() {
  19.         log("Thanks for using my script");
  20.     }
  21.  
  22.     // What it will be chopping or going to !
  23.     private void Chop() {
  24.         final RSObject Tree = objects.getNearest(38616, 38627, 58006);
  25.         if (Tree.isOnScreen() && Tree != null) {
  26.             if (getMyPlayer().getAnimation() == -1) {
  27.                 if (Tree.interact("Chop down")) {
  28.                     sleep(random(1500, 2000));
  29.                     while (players.getMyPlayer().isMoving()
  30.                             && Tree.isOnScreen() && Tree != null) {
  31.                         sleep(random(200, 800));
  32.                     }
  33.                 }
  34.             }
  35.         }
  36.         //START: Code generated using Enfilade's Easel
  37.     private final Color color1 = new Color(51, 255, 255);
  38.     private final Color color2 = new Color(255, 51, 51);
  39.     private final Color color3 = new Color(0, 0, 0);
  40.     private final Color color4 = new Color(0, 204, 51);
  41.  
  42.     private final BasicStroke stroke1 = new BasicStroke(1);
  43.  
  44.     private final Font font1 = new Font("Arial", 0, 9);
  45.     private final Font font2 = new Font("Arial", 1, 15);
  46.     private final Font font3 = new Font("Arial", 1, 12);
  47.  
  48.     public void onRepaint(Graphics g1) {
  49.         Graphics2D g = (Graphics2D)g1;
  50.         g.setColor(color1);
  51.         g.fillRect(10, 351, 486, 103);
  52.         g.setColor(color2);
  53.         g.setStroke(stroke1);
  54.         g.drawRect(10, 351, 486, 103);
  55.         g.setFont(font1);
  56.         g.setColor(color3);
  57.         g.drawString("Time Running:", 17, 372);
  58.         g.drawString("Time Till Level:", 15, 396);
  59.         g.drawString("Exp Gained:", 17, 418);
  60.         g.drawString("Exp Per Hour:", 13, 440);
  61.         g.drawString("Profit Gained:", 199, 370);
  62.         g.drawString("Profit Per Hour:", 199, 388);
  63.         g.drawString("Logs Cut:", 206, 403);
  64.         g.drawString("Logs Per Hour:", 201, 420);
  65.         g.drawString("Logs Till Next Level:", 186, 439);
  66.         g.setFont(font2);
  67.         g.drawString("ZhChopper by Zh3", 340, 373);
  68.         g.setFont(font3);
  69.         g.drawString("First Script!", 360, 415);
  70.         g.fillRoundRect(17, 320, 489, 12, 16, 16);
  71.         g.setColor(color2);
  72.         g.drawRoundRect(17, 320, 489, 12, 16, 16);
  73.         g.fillRoundRect(323, 321, 178, 9, 16, 16);
  74.         g.drawRoundRect(323, 321, 178, 9, 16, 16);
  75.         g.setColor(color4);
  76.         g.fillRoundRect(22, 322, 319, 9, 16, 16);
  77.         g.drawRoundRect(22, 322, 319, 9, 16, 16);
  78.     }
  79.     //END: Code generated using Enfilade's Easel}
  80.  
  81.     @Override
  82.     public int loop() {
  83.         antiBan();
  84.         if (inventory.isFull()) {
  85.             inventory.dropAllExcept(1359);
  86.         } else {
  87.             Chop();
  88.         }
  89.         return random(200, 800);
  90.     }
  91.  
  92.     // Antiban methods
  93.     private void antiBan() {
  94.         switch (random(1, 20)) {
  95.         case 1:
  96.             camera.moveRandomly(560);
  97.             break;
  98.         case 6:
  99.             camera.moveRandomly(400);
  100.             break;
  101.         case 13:
  102.             camera.moveRandomly(100);
  103.             break;
  104.         case 8:
  105.             mouse.moveOffScreen();
  106.             break;
  107.         case 17:
  108.             mouse.moveSlightly();
  109.            
  110.         }
  111.     }
  112. }
Add Comment
Please, Sign In to add comment