daily pastebin goal
33%
SHARE
TWEET

Untitled

a guest Jul 11th, 2018 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*this script was made by lukas76 pm on any ideas for the script and i may add them :))
  2. all it does atm is powermine iron at most places where iron rocks can be found Enjoy :)
  3. !!!***I have a very special thanks to discardedx2 for teaching me how to script THANK YOU!!! :))***!!!
  4. big credits 2 matix for helping with errors ty
  5. */
  6. package com.scripts;
  7.  
  8. import com.kbot2.scriptable.methods.data.Walking;
  9. import java.util.Random;
  10. import java.awt.*;
  11. import com.kbot2.scriptable.Script;
  12. import com.kbot2.scriptable.methods.wrappers.*;
  13. import com.kbot2.handlers.eventSystem.eventListeners.PaintListener;
  14. import com.kbot2.handlers.eventSystem.eventListeners.ServerMessageListener;
  15.  
  16. public class IronMiner extends Script implements PaintListener, ServerMessageListener {
  17.     int rockID[] = {11955,11954,11956} ;
  18.     private int oreMined;
  19.     String status = "";
  20.     public int scrollX = 271;
  21.     public int scrollY = 19;
  22.     public int origScrollX = 271;
  23.     int oreID = 440;
  24.     long StartTime;
  25.     int startXP;
  26.     int BankID = 11402;
  27.     int pickaxe[] = {1265, 1267, 1269, 1271, 1273, 1275};
  28.     Tile[] BankToMine =  new Tile[]{new Tile(3254,3420), new Tile(3254,3425),
  29.     new Tile(3258,3428), new Tile(3263,3428), new Tile(3269,3428), new Tile(3274,3427),
  30.     new Tile(3279,3424), new Tile(3284,3422), new Tile(3285,3417), new Tile(3285,3412),
  31.     new Tile(3288,3408), new Tile(3290,3403), new Tile(3290,3398), new Tile(3290,3393),
  32.     new Tile(3290,3388), new Tile(3291,3383), new Tile(3293,3378), new Tile(3290,3374),
  33.     new Tile(3287,3370), };
  34.     @SuppressWarnings("static-access")
  35.     Tile[] MineToBank = walking.reversePath(BankToMine);
  36.  
  37.     @Override
  38.     public boolean active() {
  39.     return true;
  40.     }
  41.     @Override
  42.     @SuppressWarnings("static-access")
  43.     public boolean onStart() {
  44.         StartTime = System.currentTimeMillis();
  45.         log("Lukas76's first script enjoy :P");
  46.         startXP = skills.getExperience(skills.SKILL_MINING);
  47.         if (!inventory.isFull()) {
  48.         setMouseSpeed(3);
  49.         walking.walkPath(walking.randomizePath(BankToMine, 2, 2));
  50.         setMouseSpeed(3);
  51.         mining();
  52.         }else{
  53.         setMouseSpeed(3);
  54.         walking.walkPath(walking.randomizePath(MineToBank, 2, 2));
  55.         setMouseSpeed(3);
  56.             bank();
  57.         }
  58.         return true;
  59.     }
  60.     @Override
  61.     public void onStop() {
  62.         log("Thanks for using my script");
  63.         gameScreen.takeScreenshot("Progress"+random(1,9999), true);
  64.     }
  65.  
  66.     public String getName() {
  67.         return "IronMiner";
  68.     }
  69.     public void onServerMessage(String m) {
  70.         if(m.contains("mine some"))
  71.         oreMined++;
  72.         }
  73.     public String getAuthor() {
  74.         return "lukas76";
  75.     }
  76.  
  77.     public String getDescription() {
  78.         return "Mines and banks iron in east varrock mine :D";
  79.     }
  80.  
  81.  
  82.  
  83.     /* Main Loop */
  84.     @SuppressWarnings("static-access")
  85.     public int loop() {
  86.         camera.setAltitude(true);
  87.         setMouseSpeed(3);
  88.         mining();
  89.         antiBan();
  90.         if (walking.getEnergy() > 50);{
  91.          walking.setRunning(true);
  92.         }
  93.         if (inventory.isFull()) {
  94.             setMouseSpeed(3);
  95.             walking.walkPath(walking.randomizePath(MineToBank, 2, 2));
  96.             setMouseSpeed(3);
  97.             bank();
  98.         }
  99.        
  100.          
  101.        
  102.         return random(500, 800);
  103. }
  104.  
  105.     /* Paint */
  106.     @SuppressWarnings("static-access")
  107.     public void onRepaint(Graphics g) {
  108.         long runTime = System.currentTimeMillis() - StartTime;
  109.         int secs = ((int) ((runTime / 1000) % 60));
  110.         int mins = ((int) (((runTime / 1000) / 60) % 60));
  111.         int hours = ((int) ((((runTime / 1000) / 60) / 60) % 60));
  112.         int x = 0;
  113.         int y = 6;
  114.         int gainedXP = 0;
  115.         if (startXP != 0)
  116.         {
  117.             @SuppressWarnings("static-access")
  118.         int currentXP = skills.getExperience(skills.SKILL_MINING);
  119.         gainedXP = currentXP - startXP;
  120.         }
  121.         g.setColor(Color.BLACK);
  122.         g.fill3DRect(x, y, 166, 115, true);
  123.         x += 5;
  124.         y += 15;
  125.         g.setColor(Color.WHITE);
  126.         g.drawString("IronMiner", x, y);
  127.         y += 20;
  128.         g.drawString("Ore mined: " + oreMined, x, y);
  129.         y += 15;
  130.         g.drawString("Current Level: " + skills.getLevel(skills.SKILL_MINING), x, y);
  131.         y += 15;
  132.         g.drawString("Experience Gained: " + gainedXP, x, y);
  133.         y += 15;
  134.         g.drawString("Run time: " + (hours < 10 ? "0" : "") + hours + ":"
  135.         + (mins < 10 ? "0" : "") + mins + ":" + (secs < 10 ? "0" : "")
  136.         + secs, x, y);
  137.         y += 15;
  138.         g.drawString("Version 1.0", x, y);
  139.         y += 15;
  140.         g.drawString("by Lukas76", x, y);
  141.         y += 15;
  142.         g.drawString("enjoy :)", x, y);
  143.         y += 15;
  144.         g.setColor(Color.red);
  145.         g.drawString("lukas76's Iron PowerMiner ", scrollX, scrollY);//credits to dezired for the scrolling paint program
  146.         scrollX = scrollX+1;
  147.         if(scrollX > origScrollX+249) {
  148.         scrollX = origScrollX;
  149.  
  150.         }
  151.     }
  152.  
  153.     @SuppressWarnings("static-access")
  154.   private void antiBan() {
  155.         int A = random(0, 215);
  156.         switch (A) {
  157.             case 1:
  158.                 camera.setCompass('n');
  159.                 mouse.moveMouse(random(300, 442), random(309, 449));
  160.                 sleep(600, 900);
  161.                 break;
  162.             case 2:
  163.                 gameScreen.openTab(gameScreen.TAB_EMOTES);
  164.                 sleep(600, 800);
  165.                 break;
  166.             case 3:
  167.                 gameScreen.openTab(gameScreen.TAB_OPTIONS);
  168.                 mouse.moveMouse(random(599, 396), random(590, 391));
  169.                 sleep(1500, 1700);
  170.                 mouse.moveMouse(random(194, 464), random(190, 469));
  171.                 sleep(700, 900);
  172.                 break;
  173.             case 4:
  174.                 gameScreen.openTab(gameScreen.TAB_FRIENDS);
  175.                 mouse.moveMouse(random(591, 382), random(590, 380));
  176.                 sleep(500, 800);
  177.                 break;
  178.             case 5:
  179.                 sleep(1000, 1500);
  180.                 break;
  181.             case 6:
  182.                 gameScreen.openTab(gameScreen.TAB_STATS);
  183.                 sleep(600, 800);
  184.                 break;
  185.             case 7:
  186.                 gameScreen.openTab(gameScreen.TAB_EQUIPMENT);
  187.                 camera.setCompass('w');
  188.                 sleep(300, 500);
  189.                 break;
  190.             case 8:
  191.                 gameScreen.openTab(gameScreen.TAB_DIARIES);
  192.                 mouse.moveMouse(random(536, 484), random(539, 490));
  193.                 sleep(100, 400);
  194.                 break;
  195.             case 9:
  196.                 gameScreen.openTab(gameScreen.TAB_STATS);
  197.                 camera.setCompass('e');
  198.                 mouse.moveMouse(693, 242);
  199.                 sleep(500, 800);
  200.                 break;
  201.             }
  202.     }
  203.  
  204.  
  205.   private int bank() {
  206.         if (bank.isOpen()) {
  207.             bank.depositAllExcept(pickaxe);
  208.             setMouseSpeed(3);
  209.             bank.close();
  210.             return random(500, 800);
  211.             }
  212.             else {
  213.             if (!bank.isOpen()) {
  214.             log("Banking");
  215.             Obj bankbooth = getClosestObject(30, BankID);
  216.             if (bankbooth != null) {
  217.             if (distanceTo(bankbooth) < 5) {
  218.             setMouseSpeed(3);
  219.             bankbooth.doAction("Use-quickly");
  220.             bank.depositAllExcept(pickaxe);
  221.             bank.close();
  222.             sleep(300, 500);
  223.             setMouseSpeed(3);
  224.             walking.walkPath(walking.randomizePath(BankToMine, 2, 2));
  225.             setMouseSpeed(3);
  226.             return random(1000, 1500);
  227.                 }
  228.             }
  229.         }
  230.         }
  231.  
  232.         // This won't be returned, it's just to suppress the error
  233.         return random(600, 700);
  234.     }
  235.     public void mining() {
  236.             Obj j = getClosestObject(20, rockID);
  237.             if (getMyPlayer().getAnimation() == -1) {
  238.             if (j !=null) {
  239.             j.doAction("Mine");
  240.             sleep(1500, 1700);
  241.             }
  242.         }
  243.     }
  244. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Pastebin PRO 'SUMMER SPECIAL'!
Get 60% OFF Pastebin PRO accounts!
 
Top