Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*this script was made by lukas76 pm on any ideas for the script and i may add them :))
- all it does atm is powermine iron at most places where iron rocks can be found Enjoy :)
- !!!***I have a very special thanks to discardedx2 for teaching me how to script THANK YOU!!! :))***!!!
- big credits 2 matix for helping with errors ty
- */
- package com.scripts;
- import com.kbot2.scriptable.methods.data.Walking;
- import java.util.Random;
- import java.awt.*;
- import com.kbot2.scriptable.Script;
- import com.kbot2.scriptable.methods.wrappers.*;
- import com.kbot2.handlers.eventSystem.eventListeners.PaintListener;
- import com.kbot2.handlers.eventSystem.eventListeners.ServerMessageListener;
- public class IronMiner extends Script implements PaintListener, ServerMessageListener {
- int rockID[] = {11955,11954,11956} ;
- private int oreMined;
- String status = "";
- public int scrollX = 271;
- public int scrollY = 19;
- public int origScrollX = 271;
- int oreID = 440;
- long StartTime;
- int startXP;
- int BankID = 11402;
- int pickaxe[] = {1265, 1267, 1269, 1271, 1273, 1275};
- Tile[] BankToMine = new Tile[]{new Tile(3254,3420), new Tile(3254,3425),
- new Tile(3258,3428), new Tile(3263,3428), new Tile(3269,3428), new Tile(3274,3427),
- new Tile(3279,3424), new Tile(3284,3422), new Tile(3285,3417), new Tile(3285,3412),
- new Tile(3288,3408), new Tile(3290,3403), new Tile(3290,3398), new Tile(3290,3393),
- new Tile(3290,3388), new Tile(3291,3383), new Tile(3293,3378), new Tile(3290,3374),
- new Tile(3287,3370), };
- @SuppressWarnings("static-access")
- Tile[] MineToBank = walking.reversePath(BankToMine);
- @Override
- public boolean active() {
- return true;
- }
- @Override
- @SuppressWarnings("static-access")
- public boolean onStart() {
- StartTime = System.currentTimeMillis();
- log("Lukas76's first script enjoy :P");
- startXP = skills.getExperience(skills.SKILL_MINING);
- if (!inventory.isFull()) {
- setMouseSpeed(3);
- walking.walkPath(walking.randomizePath(BankToMine, 2, 2));
- setMouseSpeed(3);
- mining();
- }else{
- setMouseSpeed(3);
- walking.walkPath(walking.randomizePath(MineToBank, 2, 2));
- setMouseSpeed(3);
- bank();
- }
- return true;
- }
- @Override
- public void onStop() {
- log("Thanks for using my script");
- gameScreen.takeScreenshot("Progress"+random(1,9999), true);
- }
- public String getName() {
- return "IronMiner";
- }
- public void onServerMessage(String m) {
- if(m.contains("mine some"))
- oreMined++;
- }
- public String getAuthor() {
- return "lukas76";
- }
- public String getDescription() {
- return "Mines and banks iron in east varrock mine :D";
- }
- /* Main Loop */
- @SuppressWarnings("static-access")
- public int loop() {
- camera.setAltitude(true);
- setMouseSpeed(3);
- mining();
- antiBan();
- if (walking.getEnergy() > 50);{
- walking.setRunning(true);
- }
- if (inventory.isFull()) {
- setMouseSpeed(3);
- walking.walkPath(walking.randomizePath(MineToBank, 2, 2));
- setMouseSpeed(3);
- bank();
- }
- return random(500, 800);
- }
- /* Paint */
- @SuppressWarnings("static-access")
- public void onRepaint(Graphics g) {
- long runTime = System.currentTimeMillis() - StartTime;
- int secs = ((int) ((runTime / 1000) % 60));
- int mins = ((int) (((runTime / 1000) / 60) % 60));
- int hours = ((int) ((((runTime / 1000) / 60) / 60) % 60));
- int x = 0;
- int y = 6;
- int gainedXP = 0;
- if (startXP != 0)
- {
- @SuppressWarnings("static-access")
- int currentXP = skills.getExperience(skills.SKILL_MINING);
- gainedXP = currentXP - startXP;
- }
- g.setColor(Color.BLACK);
- g.fill3DRect(x, y, 166, 115, true);
- x += 5;
- y += 15;
- g.setColor(Color.WHITE);
- g.drawString("IronMiner", x, y);
- y += 20;
- g.drawString("Ore mined: " + oreMined, x, y);
- y += 15;
- g.drawString("Current Level: " + skills.getLevel(skills.SKILL_MINING), x, y);
- y += 15;
- g.drawString("Experience Gained: " + gainedXP, x, y);
- y += 15;
- g.drawString("Run time: " + (hours < 10 ? "0" : "") + hours + ":"
- + (mins < 10 ? "0" : "") + mins + ":" + (secs < 10 ? "0" : "")
- + secs, x, y);
- y += 15;
- g.drawString("Version 1.0", x, y);
- y += 15;
- g.drawString("by Lukas76", x, y);
- y += 15;
- g.drawString("enjoy :)", x, y);
- y += 15;
- g.setColor(Color.red);
- g.drawString("lukas76's Iron PowerMiner ", scrollX, scrollY);//credits to dezired for the scrolling paint program
- scrollX = scrollX+1;
- if(scrollX > origScrollX+249) {
- scrollX = origScrollX;
- }
- }
- @SuppressWarnings("static-access")
- private void antiBan() {
- int A = random(0, 215);
- switch (A) {
- case 1:
- camera.setCompass('n');
- mouse.moveMouse(random(300, 442), random(309, 449));
- sleep(600, 900);
- break;
- case 2:
- gameScreen.openTab(gameScreen.TAB_EMOTES);
- sleep(600, 800);
- break;
- case 3:
- gameScreen.openTab(gameScreen.TAB_OPTIONS);
- mouse.moveMouse(random(599, 396), random(590, 391));
- sleep(1500, 1700);
- mouse.moveMouse(random(194, 464), random(190, 469));
- sleep(700, 900);
- break;
- case 4:
- gameScreen.openTab(gameScreen.TAB_FRIENDS);
- mouse.moveMouse(random(591, 382), random(590, 380));
- sleep(500, 800);
- break;
- case 5:
- sleep(1000, 1500);
- break;
- case 6:
- gameScreen.openTab(gameScreen.TAB_STATS);
- sleep(600, 800);
- break;
- case 7:
- gameScreen.openTab(gameScreen.TAB_EQUIPMENT);
- camera.setCompass('w');
- sleep(300, 500);
- break;
- case 8:
- gameScreen.openTab(gameScreen.TAB_DIARIES);
- mouse.moveMouse(random(536, 484), random(539, 490));
- sleep(100, 400);
- break;
- case 9:
- gameScreen.openTab(gameScreen.TAB_STATS);
- camera.setCompass('e');
- mouse.moveMouse(693, 242);
- sleep(500, 800);
- break;
- }
- }
- private int bank() {
- if (bank.isOpen()) {
- bank.depositAllExcept(pickaxe);
- setMouseSpeed(3);
- bank.close();
- return random(500, 800);
- }
- else {
- if (!bank.isOpen()) {
- log("Banking");
- Obj bankbooth = getClosestObject(30, BankID);
- if (bankbooth != null) {
- if (distanceTo(bankbooth) < 5) {
- setMouseSpeed(3);
- bankbooth.doAction("Use-quickly");
- bank.depositAllExcept(pickaxe);
- bank.close();
- sleep(300, 500);
- setMouseSpeed(3);
- walking.walkPath(walking.randomizePath(BankToMine, 2, 2));
- setMouseSpeed(3);
- return random(1000, 1500);
- }
- }
- }
- }
- // This won't be returned, it's just to suppress the error
- return random(600, 700);
- }
- public void mining() {
- Obj j = getClosestObject(20, rockID);
- if (getMyPlayer().getAnimation() == -1) {
- if (j !=null) {
- j.doAction("Mine");
- sleep(1500, 1700);
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment