• Log in or sign up for an account here: https://www.sythe.org/login

.:[~]Official RSBot Scripts+Requests Sticky!{RSBot}[~]:.

Status
Not open for further replies.
Did you update Karajama Fisher to the latest version (V 1.18)? It was getting stuck on the boat. Somebody at RSBot fixed it 2 days ago. Here's what I've got in case your version isn't updated.

Code:
/*             KaramjaFisher.java

*                      v.1.81

*        By Linux_Communist

*   Fixed by veejay, samyyy123, mrz, Stinky_Icecream.

*            www.chemfy.fi

*         First release 26.03.08

*

* Features:

* -Can bank or power

* -Can catch lobsters, tuna, swordfish.

* -Anti whirlpool, random combat, losing tools, logout

* -Deathwalk

*

*

* With harpoon argument it fishes tuna and swordfish.

* With tuna/swordfish argument it fishes for tuna and swordfish but

* drops the other fish.

*

* Updates:

* Karamja Fisher 1.3

* - Removed bugs

* - Put working bank

*

* Karamja Fisher 1.4

* - The script text box is now in a better place with a frame

* - Added text "Holding ** fishes"

*

* Karamja Fisher 1.5

* - Calculator till next lvl.

* - "exp" will be changed to "XP".

* - "Banked *** lobster"/swordfish/etc will be added "s".

* - In credits will be added a dot.

*

* Karamja Fisher 1.6

* - Removed warnings

* - "sworfishes" were renamed to "swordfishes"

* - Doesn't click anymore on papermap

* - Withdrawing 60 gp, if inventory has less money than 60 gp. NOTE: CASH SHOULD BE IN 1st SLOT!  Cash tab should be already opened!   And fishes should be in the cash tab.

*

* Karamja Fisher 1.7

* - Added more custom's officers

* - Fixed clicking / answering for custom's officer's questions

* - Won't wait 5-7 seconds after clicking on "Pay-Fare". It will wait 1-2 seconds.

* - Now script can withdraw anything, so cash can be anywhere.

*

* Karamja Fisher 1.8

* - Fixed withdraw/deposit of tools - by fusion89k

* - Fixed tuna dropping in swordie fishing method - by fusion89k

*
* Karamja Fisher 1.81
* - Fixed plank crossing ( Where jagex removed the object ID ) now uses a tile location. - by Stinky_icecream

*/





import java.awt.*;

import java.util.Map;



import com.speljohan.rsbot.bot.Bot;

import com.speljohan.rsbot.script.Script;

import com.speljohan.rsbot.script.wrappers.*;

import com.speljohan.rsbot.event.listeners.PaintListener;

import java.awt.event.KeyEvent;





public class KaramjaFisher extends Script implements PaintListener {



    private static final Color BLACK = new Color(0, 0, 0, 100);

    public static final Color GREEN = new Color(0, 255, 0, 255);

    private static final Color ORANGE = new Color(255, 128, 0, 255);



    public boolean interfaceExists(int id) {

        boolean[] vi = Bot.getClient().getValidInterfaceArray();

        if (vi == null) {

            return false;

        }

        if (!(id < vi.length)) {

            return false;

        }

        return vi[id];

    }

public void turnCamera() {

        char[] LR = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT };

        char[] UD = new char[] { KeyEvent.VK_UP, KeyEvent.VK_DOWN };

        char[] LRUD = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT,

                KeyEvent.VK_UP, KeyEvent.VK_DOWN };

        int random2 = random(0, 2);

        int random1 = random(0, 2);

        int random4 = random(0, 4);



        if (random(0, 3) == 0) {

            Bot.getInputManager().pressKey(LR[random1]);

            try {

                Thread.sleep(random(100, 400));

            } catch (Exception e) {

            }

            Bot.getInputManager().pressKey(UD[random2]);

            try {

                Thread.sleep(random(300, 600));

            } catch (Exception e) {

            }

            Bot.getInputManager().releaseKey(UD[random2]);

            try {

                Thread.sleep(random(100, 400));

            } catch (Exception e) {

            }

            Bot.getInputManager().releaseKey(LR[random1]);

        } else {

            Bot.getInputManager().pressKey(LRUD[random4]);

            if (random4 > 1)

                try {

                    Thread.sleep(random(300, 600));

                } catch (Exception e) {

                }

            else

                try {

                    Thread.sleep(random(500, 900));

                } catch (Exception e) {

                }

            Bot.getInputManager().releaseKey(LRUD[random4]);

        }

    }



    public void onRepaint(Graphics g)

    {

        if(isLoggedIn()) {

            long millis = System.currentTimeMillis() - startTime;

            long hours = millis / (1000 * 60 * 60);

            millis -= hours * (1000 * 60 * 60);

            long minutes = millis / (1000 * 60);

            millis -= minutes * (1000 * 60);

            long seconds = millis / 1000;

            int XPChange = skills.getCurrentSkillExp(10) - startXP;

            int LevelChange = skills.getCurrentSkillLevel(10) - startLevel;



            int x = 18;

            int y = 108;

            g.setColor(BLACK);

            g.fill3DRect(14, 108, 219, 214, true);

            g.setColor(GREEN);

                g.drawString(getName() + " " + getVersion(), x, y += 15);

                g.drawString("by " + getAuthor() + ", fixed by", x, y += 15);

                g.drawString(getFixers() + ".", x, y += 15);

            g.setColor(ORANGE);

            if(fishHarpoon && dropTuna)

                g.drawString("Banked " + Integer.toString(swordfishBanked) + " swordfishes.", x, y += 20);

            else if(fishHarpoon && !dropTuna && !dropSwordfish)

                g.drawString("Banked " + Integer.toString(swordfishBanked) + " swordfishes and " + Integer.toString(tunaBanked) + " tunas.", x, y += 20);

            else if(fishHarpoon && dropSwordfish)

                g.drawString("Banked " + Integer.toString(tunaBanked) + " tunas.", x, y += 20);

            else if(!fishHarpoon)

                g.drawString("Banked " + Integer.toString(lobsterBanked) + " lobsters.", x, y += 20);

                g.drawString("Runtime: " + hours + "h " + minutes + "min " + seconds + "sec.", x, y += 20);

                g.drawString("Current: " + skills.getCurrentSkillLevel(10) + " levels and " + skills.getCurrentSkillExp(10) + " XP.", x, y += 20);

                g.drawString("Gained: " + LevelChange + " levels and " + XPChange + " XP.", x, y += 20);

                g.drawString("We're " + skills.getPercentToNextLevel(10) + "% to next level, which now", x, y += 20);

                g.drawString("needs " + skills.getXPToNextLevel(10) + " XP.", x, y += 20);

            if(fishHarpoon && dropTuna)

                g.drawString("Next level needs " + skills.getXPToNextLevel(10) / 100 + " swordfishes.", x, y += 20);

            else if(fishHarpoon && !dropTuna && !dropSwordfish)

                g.drawString("Next level needs " + skills.getXPToNextLevel(10) / 90 + " both fishes.", x, y += 20);

            else if(fishHarpoon && dropSwordfish)

                g.drawString("Next level needs " + skills.getXPToNextLevel(10) / 80 + " tunas.", x, y += 20);

            else if(!fishHarpoon)

                g.drawString("Next level needs " + skills.getXPToNextLevel(10) / 90 + " lobsters.", x, y += 20);

            if(fishHarpoon && dropTuna)

                g.drawString("Holding " + getInventoryCount(swordfishID) + " swordfishes.", x, y += 20);

            else if(fishHarpoon && !dropTuna && !dropSwordfish)

                g.drawString("Holding " + getInventoryCount(swordfishID) + " swordfishes and " + getInventoryCount(tunaID) + " tunas.", x, y += 20);

            else if(fishHarpoon && dropSwordfish)

                g.drawString("Holding " + getInventoryCount(tunaID) + " tunas.", x, y += 20);

            else if(!fishHarpoon)

                g.drawString("Holding " + getInventoryCount(lobsterID) + " lobsters.", x, y += 20);



        }

        }



        public static final int lobsterID = 377;

        public static final int tunaID = 359;

        public static final int swordfishID = 371;





    // Deathpath

    private static final RSTile[] DEATH_PATH = {

                             new RSTile(3232, 3219), new RSTile(3233, 3227),

                             new RSTile(3228, 3234), new RSTile(3220, 3237),

                             new RSTile(3212, 3237), new RSTile(3204, 3238),

                             new RSTile(3196, 3240), new RSTile(3188, 3242),

                             new RSTile(3180, 3243), new RSTile(3172, 3241),

                             new RSTile(3164, 3241), new RSTile(3156, 3239),

                             new RSTile(3148, 3237), new RSTile(3140, 3235),

                             new RSTile(3135, 3229), new RSTile(3126, 3227),

                             new RSTile(3118, 3228), new RSTile(3109, 3231),

                             new RSTile(3097, 3232), new RSTile(3087, 3230)  };



    public static final RSTile[] bankPath = new RSTile[] { new RSTile(3095, 3241), new RSTile(3089, 3247), new RSTile(3081, 3246),

                            new RSTile(3073, 3249), new RSTile(3073, 3257), new RSTile(3073, 3265),

                            new RSTile(3073, 3273), new RSTile(3065, 3275), new RSTile(3061, 3268),

                            new RSTile(3059, 3260), new RSTile(3053, 3254), new RSTile(3045, 3253),

                            new RSTile(3042, 3245), new RSTile(3041, 3237), new RSTile(3033, 3237),

                            new RSTile(3028, 3230), new RSTile(3028, 3222), new RSTile(3027, 3218) };



    public static final RSTile[] karamjaPath = new RSTile[] { new RSTile(2924, 3177), new RSTile(2926, 3169),

                        new RSTile(2920, 3163), new RSTile(2917, 3155), new RSTile(2925, 3153),

                        new RSTile(2933, 3150), new RSTile(2942, 3146), new RSTile(2952, 3146) };



    public RSTile[] shipToBank = reversePath(bankPath);

    public RSTile[] shipToKaramja = reversePath(karamjaPath);

    //Fishing spot id

    public static final int[] fishingSpots = new int[] { 324 };



    public static final int lobsterPotID = 301;

    public static final int harpoonID = 311;

    public static final int coinsID = 995;

    // Getting time so we can check if we have been idle for awhile

    public long time = System.currentTimeMillis();

    // Items to drop when using power fishing and inventory is full

    public static final int[] dropThis = new int[] { 377, 359, 371 };



    public static final int[] bankWindows = new int[] { 2213 };



    public static final int[] BankCustoms = new int[] { 377, 376, 378 }; // All custom officers in port sarim, with them you can get to Karamja

    public static final int[] KaramjaCustoms = new int[] { 380 }; // All custom officers in karamja port, with them you can get to Port Sarim

    // Banks tile



    public boolean powerFish, fishHarpoon, dropTuna, dropSwordfish;



    public int startLevel = 0;

    public int startXP = 0;



    public int tunaBanked = 0;

    public int lobsterBanked = 0;

    public int swordfishBanked = 0;

    int tunaCount = 0;

    int lobsterCount = 0;

    int swordfishCount = 0;

    public long startTime = System.currentTimeMillis();



    int progress = 0;

    boolean walking = false;

    int randomTime = 0;

    boolean weAreOnKaramja = true;

    boolean sailinggp = false;



    public double getVersion() {

        return 1.81;

    }



    public String getName() {

        return "Karamja Fisher";

    }



    public String getScriptCategory() {

        return "Fishing";

    }





    public String getAuthor() {

        return "Linux_Communist";

    }



    public String getFixers() {

        return "veejay, samyyy123, mrz.";

    }





    public boolean onStart(Map<String, String> args) {



        switch(doWeHarpoon(args.get("what")))

        {

            case 1:    fishHarpoon = true;

                dropTuna = false;

                dropSwordfish = false;

                break;

            case 2: fishHarpoon = false;

                dropTuna = false;

                dropSwordfish = false;

                break;

            case 3: dropSwordfish = false;

                fishHarpoon = true;

                dropTuna = true;

                break;

            case 4: dropTuna = false;

                fishHarpoon = true;

                dropSwordfish = true;

                break;

            case 0: return false;

        }

        if(args.get("how").equals("power"))

            powerFish = true;

        else

            powerFish = false;



        if (args.get("sailingmoney").equals("take"))

            sailinggp = true;

        else sailinggp = false;



        lobsterBanked = 0;

        tunaBanked = 0;

        swordfishBanked = 0;

        startTime = System.currentTimeMillis();

        if(isLoggedIn()){

            startLevel = skills.getCurrentSkillLevel(10);

            startXP = skills.getCurrentSkillExp(10);

        }

        Bot.getEventManager().addListener(PaintListener.class, this);

        return true;

    }



    public void onFinish() {

        Bot.getEventManager().removeListener(PaintListener.class, this);

    }





    public int loop() {

        if(isLoggedIn() && startLevel == 0)

    {

        startLevel = skills.getCurrentSkillLevel(10);

        startXP = skills.getCurrentSkillExp(10);

    }



    switch(progress)

    {

        case 0: //Fishing part

                if(distanceTo(bankPath[0]) < 15) {

                    log("We are at the bank");

                    turnCamera();

                    weAreOnKaramja = false;

                    progress = 2;

                    return random(1000,2000);

                }



                if (!walking && dead()) // check if we are dead and not deathwalking

                {

                    log("Dead");

                    walking = true;

                    setRun(true);

                    return random(500, 1000);

                }

                if(walking) // Does deathwalk

                {

                    if(!getMyPlayer().isMoving())

                        doDeathWalk();

                    return random(500, 1000);

                }



                if (isInventoryFull() && !powerFish){ //If we bank and have inv full moves to next progress



                    if(dropTuna)

                        dropAllExcept(harpoonID,coinsID,swordfishID);

                    if(dropSwordfish)

                        dropAllExcept(harpoonID,coinsID,tunaID);

                    if(isInventoryFull())

                    {

                        progress++;

                        setRun(true);

                        return random(1000,1500);

                    }

                    return random(500,1000);

                } else if(isInventoryFull() && powerFish) // If we power and have inv full drops fish

                {

                    dropFish();

                }



                if(getMyPlayer().isInCombat()) // If we are in combat runs away

                {

                    runAway();

                    return random (400,700);

                }



                if(System.currentTimeMillis() - time < 30000+randomTime || getNearestNPCByID(405) != null)

                {

                    if (getMyPlayer().getAnimation() == 618 || getMyPlayer().getAnimation() == 619 || getMyPlayer().isMoving())

                    {

                        return random(350,500);

                    }

                }

                if(fishHarpoon)

                {

                    if(!inventoryContains(harpoonID))

                    {

                        if(getGroundItemByID(15, harpoonID) != null) {

                            RSItemTile item = getGroundItemByID(15, harpoonID);



                            if(item != null && !getMyPlayer().isMoving()) {

                                if(distanceTo(item) > 8) {

                                    walkTileMM(item);

                                    return random(1000,2000);

                                }



                                atTile(item, "Take");

                                return random(500, 1000);



                            } else

                                return random(500, 1000);

                        } else {

                            progress++;

                            return random(300,500);

                        }

                    }



                } else if(!fishHarpoon)

                {

                    if(!inventoryContains(lobsterPotID))

                    {

                        if(getGroundItemByID(15, lobsterPotID) != null) {

                            RSItemTile item = getGroundItemByID(15, lobsterPotID);



                            if(item != null && !getMyPlayer().isMoving()) {

                                if(distanceTo(item) > 8) {

                                    walkTileMM(item);

                                    return random(1000,2000);

                                }



                                atTile(item, "Take");

                                return random(500, 1000);



                            } else

                                return random(500,1000);

                        } else {

                            progress++;

                            return random(300,500);

                        }

                    }

                }

                fish(); // Lets fish

                randomTime = random(1000,20000); // Gets some random for the timer

                time = System.currentTimeMillis(); // resets timer

                return random(2000,3000);

        case 1:



                return walkToBank();

        case 2:

                weAreOnKaramja = false;

                RSObject bankWindow = findObject(bankWindows);

                turnCamera();

                if(distanceTo(bankWindow.getLocation()) > 5)

                {

                    walkTileMM(bankWindow.getLocation());

                    return random(500,750);

                }

                if(!interfaceExists(INTERFACE_BANK))

                {

                    atObject(bankWindow,"Use-quickly");

                    return random(1500,1750);

                }



                if(lobsterCount == 0)

                    lobsterCount = getInventoryCount(377);

                if(tunaCount == 0)

                    tunaCount = getInventoryCount(359);

                if(swordfishCount == 0)

                    swordfishCount = getInventoryCount(371);



                if(fishHarpoon){

                turnCamera();

                    bank.depositAllExcept(harpoonID, coinsID);}

                if(!fishHarpoon){

                turnCamera();

                    bank.depositAllExcept(lobsterPotID, coinsID);}



                if (sailinggp == true) { // If arguments said that we have to take 60gp for sailing, then we will take them

                    withdraw("Coins", coinsID, 60);

                }



                checkForTool();

                if(!isInventoryFull()) { // if inventory isnt full goes to second progress



                    lobsterBanked += lobsterCount;

                    lobsterCount = 0;

                    swordfishBanked += swordfishCount;

                    swordfishCount = 0;

                    tunaBanked += tunaCount;

                    tunaCount = 0;



                    progress++;

                }

                bank.close(); // close bank window



                return random(500,750);

        case 3:



                return walkToFishingSpot();

    }





        return random(500, 1000);



    }



    public boolean withdraw(String itemName, int itemID, int count) {

        bank.searchItem(itemName);

        wait(random(1000,2000));

        clickMouse(random(40, 60), random(100, 115), 1, 1, false);

        wait(random(250,500));

        if (count == 0) {

            atMenu("Withdraw-All");

            wait(random(200,300));

        }

        if (count == 1 || count == 5 || count == 10) {

            atMenu("Withdraw-" + count);

            wait(random(200,300));

        } else {

            atMenu("Withdraw-X");

            wait(random(800,1000));

            if(RSInterface.getInterface(INTERFACE_BANK_SEARCH).isValid()) {

                Bot.getInputManager().sendKeys("" + count, true);

                wait(random(700,800));

            }

        }

        wait(random(1000,2000));

        if (getInventoryCount(itemID) < 1) {

            log("Seems you don't have more " + itemName + ".");

            stopAllScripts();

        }

        wait(random(500,1000));

        clickMouse(random(301, 330), random(298, 317), 1, 1, true);

        wait(random(1000,2000));

        return true;

    }



    public int doWeHarpoon(String whatToFish) { // checks if argument contained n as in net or b as in bait

        if (whatToFish.contains("both"))

            return 1;

        else if (whatToFish.contains("lobster"))

            return 2;

        else if(whatToFish.contains("sword"))

            return 3;

        else if(whatToFish.contains("tuna"))

            return 4;

        else {

            log("To use this script give arguments either harpoon, tuna, lobster or swordfish for first and power or bank on second like \"harpoon,bank\"");

            return 0;

        }

    }



    public boolean dead() { // Are we dead ?



        return distanceTo(new RSTile(3232, 3219)) < 15;

    }



    public void doDeathWalk() { // doing deathwalk

        weAreOnKaramja = false;

        if (distanceTo(DEATH_PATH[DEATH_PATH.length-1]) < 10){

            walking = false;;



        } else

            walkPathMM(randomizePath(DEATH_PATH, 2, 2), 15);

    }



    public void dropFish() { // Dropping items that are set on dropThis array

        boolean drop = false;

        for(int i = 0; i < 27; i++)

        {

            for(int y = 0; y < dropThis.length; y++)

            {

                if(dropThis[y] == getInventoryItems()[i].getID()) {

                    drop = true;



                }

            }

            if(drop)

            {

                atInventoryItem(getInventoryItems()[i].getID(), "Drop");

                wait(random(1000,2000));

                drop = false;

            }



        }

    }



    public void drop(int id) {

        if(inventoryContains(id))

        {

            for(int i = 0; i < 27; i++)

            {

                if(getInventoryItems()[i].getID() == id)

                {

                    atInventoryItem(id, "Drop");

                    if(inventoryContains(id))

                        break;

                }

            }

        }

    }



    public void runAway() { // running away and running back after a while

        RSTile foo, bar;

        foo = getMyPlayer().getLocation();

        setRun(true);



        bar = new RSTile(foo.getX()-random(8,10),foo.getY()-random(8,10));



        walkTileMM(bar);

        wait(random(17000,20000));

        walkTileMM(foo);

    }





    public void fish() { // Fishing

        RSNPC spot = getNearestNPCByID(fishingSpots);

        if (spot == null || distanceTo(spot.getLocation()) > 25) {

            log("No (nearby) fishing spot. This sucks.");

        }

        else if (distanceTo(spot.getLocation()) > 4){

            walkTileMM(spot.getLocation());

        } else {

            weAreOnKaramja = true;

            if(fishHarpoon) atNPC(spot,"Harpoon");

            else if(!fishHarpoon) atNPC(spot,"Cage");

        }

    }



    public int walkToBank() {

        if (getMyPlayer().isMoving()) return random(250,500);
    RSTile Gangplank = new RSTile(3031, 3217);
    if (distanceTo(Gangplank) < 2){
        wait(random(6000,8000)); // Wait's 6-8 seconds till it will click on "Cross"

            if(atTile(Gangplank, "Cross"))

            {

                weAreOnKaramja = false;

                return random(2000,3000);

            }
    }
    RSTile onBoat = new RSTile(3032, 3217);

        if(distanceTo(shipToBank[0]) < 8) { weAreOnKaramja = false; }

        if(weAreOnKaramja)

        {

            if(distanceTo(karamjaPath[karamjaPath.length -1]) < 8){

                if(Bot.getClient().getInterfaceCache()[64] != null) {

                clickMouse(220+random(-77,60) ,455+random(-5,2), true); // Clicks on: Click here to continue // Interface: [64] [5]

                return random(1000,2000);

                } else if(Bot.getClient().getInterfaceCache()[228] != null) {

                clickMouse(260+random(-85,87) ,403+random(-5,3), true); // Clicks on: Can I journey on this ship? // Ok. // Interface: [228] [2]

                return random(1000,2000);

                } else if(Bot.getClient().getInterfaceCache()[230] != null) {

                clickMouse(260+random(-118,116) ,420+random(-6,5), true); // Clicks on: Search away, I have nothing to hide. // Interface: [230] [3]

                return random(1000,2000);

                } else if(Bot.getClient().getInterfaceCache()[241] != null) {

                clickMouse(310+random(-70,63) ,455+random(-7,1), true); // Clicks on: Click here to continue // Interface: [241] [5]

                return random(1000,2000);

                } else if(Bot.getClient().getInterfaceCache()[242] != null) {

                clickMouse(310+random(-73,65) ,455+random(-5,2), true); // Clicks on: Click here to continue // Interface: [242] [6]

                return random(1000,2000);

                } else {

                    RSNPC customs = getNearestNPCByID(KaramjaCustoms);

                    if(customs != null)

                    {

                        atNPC(customs, "Pay-Fare");

                        return random(1000,2000);

                    } else {



                    return random(1000,2000);

                    }

                }

            }



            walkPathMM(randomizePath(karamjaPath,2,2),12);

        } else

        {

            if (distanceTo(bankPath[0]) < 8){

                progress++;

                return random(500,750);

            }

            walkPathMM(randomizePath(shipToBank,2,2) ,15);

        }

        return random(3500,4000);

    }



    public int walkToFishingSpot() {

        if (getMyPlayer().isMoving()) return random(250,500);

        if(findObject(2082) != null) {

            wait(random(6000,8000)); // Wait's 6-8 seconds till it will click on "Cross"

            if(atObject(findObject(2082), "Cross"))

            {

                weAreOnKaramja = false;

                return random(2000,3000);

            } else return random(1000,2000);

        }

        if(distanceTo(shipToKaramja[0]) < 20) weAreOnKaramja = true;

        if(!weAreOnKaramja)

        {

            if(distanceTo(bankPath[bankPath.length -1]) < 8){

                if(Bot.getClient().getInterfaceCache()[64] != null) {

                clickMouse(220+random(-77,60) ,455+random(-5,2), true); // Clicks on: Click here to continue // Interface: [64] [5]

                return random(1000,2000);

                } else if(Bot.getClient().getInterfaceCache()[228] != null) {

                clickMouse(260+random(-28,33) ,403+random(-4,5), true); // Clicks on: Yes please.            // Interface: [228] [2]

                return random(1000,2000);

                } else if(Bot.getClient().getInterfaceCache()[241] != null) {

                clickMouse(310+random(-70,63) ,455+random(-7,1), true); // Clicks on: Click here to continue // Interface: [241] [5]

                return random(1000,2000);

                } else {

                    RSNPC customs = getNearestNPCByID(BankCustoms);

                    if(customs != null)

                    {

                        atNPC(customs, "Pay-Fare");

                        return random(1000,2000);

                    } else return random(1000,2000);

                }



            }

            walkPathMM(randomizePath(bankPath,2,2),15);

        } else

        {

            if (distanceTo(karamjaPath[0]) < 8){

                progress = 0;

                return random(500,750);

            }

            walkPathMM(randomizePath(shipToKaramja,2,2) ,18);

        }

        return random(3500,4000);



    }



    public void checkForTool() {

        boolean tool = false;

        if(fishHarpoon)

        {

            if(inventoryContains(harpoonID))

            {

                log("Have harpoon");

                tool = true;

            }

        } else if(!fishHarpoon)

        {

            if(inventoryContains(lobsterPotID))

            {

                log("Have lobster pot");

                tool = true;

            }

        }

        if(!tool)

        {

            log("No tool, taking one");

            //for(int i = 0; i < bank.getItemArray().length; i++) {

                if(!fishHarpoon)

                {



                    //if(bank.getItemArray()[i] == lobsterPotID)

                    //{

                        //withdraw("Coins", 995, 60);

                        withdraw("Lobster pot", lobsterPotID, 1);

                        //bank.atItem(lobsterPotID,"Withdraw 1");

                        tool = true;

                        log("Took lobster pot");

                    //}

                } else if(fishHarpoon)

                {

                    //if(bank.getItemArray()[i] == harpoonID)

                    //{

                        withdraw("Harpoon", 311, 1);

                        //bank.atItem(harpoonID,"Withdraw 1");

                        tool = true;

                        log("Took harpoon");

                    //}

                }

                //if(tool)

                //    break;

            //}

        }

    }

    public String getScriptDescription() {

        return "<html>\n" +

                "<head></head>\n" +

                "<body>\n" +

                    "<center>" +

                        "<h2>" + getName() + "</h2>" +

                    "</center>\n" +

                    "<b>Author:</b> " + getAuthor() + "<br />" +

                    "<b>Fixed by:</b> " + getFixers() + "<br />" +

                    "<b>Website:</b> <a href=\"http://www.chemfy.fi/\">http://www.chemfy.fi/</a><br />" +

                    "<b>Version:</b> " + getVersion() + "<br />" +



                    "<b>Features:</b>" +

                    "<ul><li>Can bank or power</li>" +

                    "<li>Can catch lobster, tuna, swordfish.</li>" +

                    "<li>Anti whirlpool, random combat, losing tools, logout.</li>" +

                    "<li>Shows fish banked and runtime.</li>" +

                    "<li>Deathwalk.</li></ul><br />" +



                    "<b>Arguments:<b><br />" +

                    "<form>Take 60gp for sailing each time:<input type=\"radio\" name=\"sailingmoney\" value=\"take\" checked=\"checked\"> yes " +

                    "<input type=\"radio\" name=\"sailingmoney\" value=\"notake\"> no<BR></form>" +

                    "<form>Bank:<input type=\"radio\" name=\"how\" value=\"bank\" checked=\"checked\"> " +

                    "Power:<input type=\"radio\" name=\"how\" value=\"power\"><br /></form>" +



                    "<form>Lobster:<input type=\"radio\" name=\"what\" value=\"lobster\" checked=\"checked\"> " +

                    "Tuna:<input type=\"radio\" name=\"what\" value=\"tuna\"> " +

                    "Swordfish:<input type=\"radio\" name=\"what\" value=\"swordfish\"> " +

                    "Tuna & Swordfish:<input type=\"radio\" name=\"what\" value=\"both\"><br /></form>" +





                "</body>\n" +

                "</html>";

    }



}
 
Could someone please fix the Flax Spinner? The Flax Picker works fine, just the Spinner don't. It would be great if someone could help, I could earn loads of cash of this!

Thanks!
 
For prayer, chaos temple bone burier, the download doesn't exist anymore...
Can you give a new link please?
 
i need an auto newt buyer that will open the door and bank.Can someone tell me how to get the DPNewtEyespro script for rsbot
 
uhm, hi i was wondering if some1 could tweak/edit the Karajma script (above) because when my guy goes 2 the karajama sailor (in port sariam) and clicks the 2nd option (pay-fare) he arrives on the BOAT at karajama and he wont cross gangplank because apparently thats not in the script?, could some1 edit it for me so it clicks the gangplank
 
The AntiBan SUCKS! I used it, and some guy asked some1 else for heir summonning level, and I said '1' and I kept saying "+skillevel+extra"

Hope I don't get banned!
 
How do i replace the old karamjafisherbanker with the updated one that doesn't get stuck at the boat?
 
So, I decided to get back in to RS, decided to give RSBot a go and am wondering what the best Chicken fighting script is? Just need to get the levels up to a decent level so I can go fight cows, etc. I am currently using DrChicken, but it seems very slow.

Thanks,

en
 
use the "Monster Killer" script that came, then go to "debug' and click the Checks on "NPC's" then the numbers in green you c fill them into the "Monster ID" (all 4 boxes have to be filled u can use the same one over, but normaly every monster has at least 3 diferent ID's) Then type in the monsters name like for chickens i'd do "Chicken" and name2 "Chickens", eat, bury, up2 u if u want those. Unselect collect coins. Run the script, and have fun slaughtering chickens. If u dont have the script for "Monster Killer" (or a diferent one then mine) i can send you the script (.java) and (.class) for it.

Signed,
deadlywario0
 
Did you update Karajama Fisher to the latest version (V 1.18)? It was getting stuck on the boat. Somebody at RSBot fixed it 2 days ago. Here's what I've got in case your version isn't updated.

Code:
/*             KaramjaFisher.java

*                      v.1.81

*        By Linux_Communist

*   Fixed by veejay, samyyy123, mrz, Stinky_Icecream.

*            www.chemfy.fi

*         First release 26.03.08

*

* Features:

* -Can bank or power

* -Can catch lobsters, tuna, swordfish.

* -Anti whirlpool, random combat, losing tools, logout

* -Deathwalk

*

*

* With harpoon argument it fishes tuna and swordfish.

* With tuna/swordfish argument it fishes for tuna and swordfish but

* drops the other fish.

*

* Updates:

* Karamja Fisher 1.3

* - Removed bugs

* - Put working bank

*

* Karamja Fisher 1.4

* - The script text box is now in a better place with a frame

* - Added text "Holding ** fishes"

*

* Karamja Fisher 1.5

* - Calculator till next lvl.

* - "exp" will be changed to "XP".

* - "Banked *** lobster"/swordfish/etc will be added "s".

* - In credits will be added a dot.

*

* Karamja Fisher 1.6

* - Removed warnings

* - "sworfishes" were renamed to "swordfishes"

* - Doesn't click anymore on papermap

* - Withdrawing 60 gp, if inventory has less money than 60 gp. NOTE: CASH SHOULD BE IN 1st SLOT!  Cash tab should be already opened!   And fishes should be in the cash tab.

*

* Karamja Fisher 1.7

* - Added more custom's officers

* - Fixed clicking / answering for custom's officer's questions

* - Won't wait 5-7 seconds after clicking on "Pay-Fare". It will wait 1-2 seconds.

* - Now script can withdraw anything, so cash can be anywhere.

*

* Karamja Fisher 1.8

* - Fixed withdraw/deposit of tools - by fusion89k

* - Fixed tuna dropping in swordie fishing method - by fusion89k

*
* Karamja Fisher 1.81
* - Fixed plank crossing ( Where jagex removed the object ID ) now uses a tile location. - by Stinky_icecream

*/





import java.awt.*;

import java.util.Map;



import com.speljohan.rsbot.bot.Bot;

import com.speljohan.rsbot.script.Script;

import com.speljohan.rsbot.script.wrappers.*;

import com.speljohan.rsbot.event.listeners.PaintListener;

import java.awt.event.KeyEvent;





public class KaramjaFisher extends Script implements PaintListener {



    private static final Color BLACK = new Color(0, 0, 0, 100);

    public static final Color GREEN = new Color(0, 255, 0, 255);

    private static final Color ORANGE = new Color(255, 128, 0, 255);



    public boolean interfaceExists(int id) {

        boolean[] vi = Bot.getClient().getValidInterfaceArray();

        if (vi == null) {

            return false;

        }

        if (!(id < vi.length)) {

            return false;

        }

        return vi[id];

    }

public void turnCamera() {

        char[] LR = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT };

        char[] UD = new char[] { KeyEvent.VK_UP, KeyEvent.VK_DOWN };

        char[] LRUD = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT,

                KeyEvent.VK_UP, KeyEvent.VK_DOWN };

        int random2 = random(0, 2);

        int random1 = random(0, 2);

        int random4 = random(0, 4);



        if (random(0, 3) == 0) {

            Bot.getInputManager().pressKey(LR[random1]);

            try {

                Thread.sleep(random(100, 400));

            } catch (Exception e) {

            }

            Bot.getInputManager().pressKey(UD[random2]);

            try {

                Thread.sleep(random(300, 600));

            } catch (Exception e) {

            }

            Bot.getInputManager().releaseKey(UD[random2]);

            try {

                Thread.sleep(random(100, 400));

            } catch (Exception e) {

            }

            Bot.getInputManager().releaseKey(LR[random1]);

        } else {

            Bot.getInputManager().pressKey(LRUD[random4]);

            if (random4 > 1)

                try {

                    Thread.sleep(random(300, 600));

                } catch (Exception e) {

                }

            else

                try {

                    Thread.sleep(random(500, 900));

                } catch (Exception e) {

                }

            Bot.getInputManager().releaseKey(LRUD[random4]);

        }

    }



    public void onRepaint(Graphics g)

    {

        if(isLoggedIn()) {

            long millis = System.currentTimeMillis() - startTime;

            long hours = millis / (1000 * 60 * 60);

            millis -= hours * (1000 * 60 * 60);

            long minutes = millis / (1000 * 60);

            millis -= minutes * (1000 * 60);

            long seconds = millis / 1000;

            int XPChange = skills.getCurrentSkillExp(10) - startXP;

            int LevelChange = skills.getCurrentSkillLevel(10) - startLevel;



            int x = 18;

            int y = 108;

            g.setColor(BLACK);

            g.fill3DRect(14, 108, 219, 214, true);

            g.setColor(GREEN);

                g.drawString(getName() + " " + getVersion(), x, y += 15);

                g.drawString("by " + getAuthor() + ", fixed by", x, y += 15);

                g.drawString(getFixers() + ".", x, y += 15);

            g.setColor(ORANGE);

            if(fishHarpoon && dropTuna)

                g.drawString("Banked " + Integer.toString(swordfishBanked) + " swordfishes.", x, y += 20);

            else if(fishHarpoon && !dropTuna && !dropSwordfish)

                g.drawString("Banked " + Integer.toString(swordfishBanked) + " swordfishes and " + Integer.toString(tunaBanked) + " tunas.", x, y += 20);

            else if(fishHarpoon && dropSwordfish)

                g.drawString("Banked " + Integer.toString(tunaBanked) + " tunas.", x, y += 20);

            else if(!fishHarpoon)

                g.drawString("Banked " + Integer.toString(lobsterBanked) + " lobsters.", x, y += 20);

                g.drawString("Runtime: " + hours + "h " + minutes + "min " + seconds + "sec.", x, y += 20);

                g.drawString("Current: " + skills.getCurrentSkillLevel(10) + " levels and " + skills.getCurrentSkillExp(10) + " XP.", x, y += 20);

                g.drawString("Gained: " + LevelChange + " levels and " + XPChange + " XP.", x, y += 20);

                g.drawString("We're " + skills.getPercentToNextLevel(10) + "% to next level, which now", x, y += 20);

                g.drawString("needs " + skills.getXPToNextLevel(10) + " XP.", x, y += 20);

            if(fishHarpoon && dropTuna)

                g.drawString("Next level needs " + skills.getXPToNextLevel(10) / 100 + " swordfishes.", x, y += 20);

            else if(fishHarpoon && !dropTuna && !dropSwordfish)

                g.drawString("Next level needs " + skills.getXPToNextLevel(10) / 90 + " both fishes.", x, y += 20);

            else if(fishHarpoon && dropSwordfish)

                g.drawString("Next level needs " + skills.getXPToNextLevel(10) / 80 + " tunas.", x, y += 20);

            else if(!fishHarpoon)

                g.drawString("Next level needs " + skills.getXPToNextLevel(10) / 90 + " lobsters.", x, y += 20);

            if(fishHarpoon && dropTuna)

                g.drawString("Holding " + getInventoryCount(swordfishID) + " swordfishes.", x, y += 20);

            else if(fishHarpoon && !dropTuna && !dropSwordfish)

                g.drawString("Holding " + getInventoryCount(swordfishID) + " swordfishes and " + getInventoryCount(tunaID) + " tunas.", x, y += 20);

            else if(fishHarpoon && dropSwordfish)

                g.drawString("Holding " + getInventoryCount(tunaID) + " tunas.", x, y += 20);

            else if(!fishHarpoon)

                g.drawString("Holding " + getInventoryCount(lobsterID) + " lobsters.", x, y += 20);



        }

        }



        public static final int lobsterID = 377;

        public static final int tunaID = 359;

        public static final int swordfishID = 371;





    // Deathpath

    private static final RSTile[] DEATH_PATH = {

                             new RSTile(3232, 3219), new RSTile(3233, 3227),

                             new RSTile(3228, 3234), new RSTile(3220, 3237),

                             new RSTile(3212, 3237), new RSTile(3204, 3238),

                             new RSTile(3196, 3240), new RSTile(3188, 3242),

                             new RSTile(3180, 3243), new RSTile(3172, 3241),

                             new RSTile(3164, 3241), new RSTile(3156, 3239),

                             new RSTile(3148, 3237), new RSTile(3140, 3235),

                             new RSTile(3135, 3229), new RSTile(3126, 3227),

                             new RSTile(3118, 3228), new RSTile(3109, 3231),

                             new RSTile(3097, 3232), new RSTile(3087, 3230)  };



    public static final RSTile[] bankPath = new RSTile[] { new RSTile(3095, 3241), new RSTile(3089, 3247), new RSTile(3081, 3246),

                            new RSTile(3073, 3249), new RSTile(3073, 3257), new RSTile(3073, 3265),

                            new RSTile(3073, 3273), new RSTile(3065, 3275), new RSTile(3061, 3268),

                            new RSTile(3059, 3260), new RSTile(3053, 3254), new RSTile(3045, 3253),

                            new RSTile(3042, 3245), new RSTile(3041, 3237), new RSTile(3033, 3237),

                            new RSTile(3028, 3230), new RSTile(3028, 3222), new RSTile(3027, 3218) };



    public static final RSTile[] karamjaPath = new RSTile[] { new RSTile(2924, 3177), new RSTile(2926, 3169),

                        new RSTile(2920, 3163), new RSTile(2917, 3155), new RSTile(2925, 3153),

                        new RSTile(2933, 3150), new RSTile(2942, 3146), new RSTile(2952, 3146) };



    public RSTile[] shipToBank = reversePath(bankPath);

    public RSTile[] shipToKaramja = reversePath(karamjaPath);

    //Fishing spot id

    public static final int[] fishingSpots = new int[] { 324 };



    public static final int lobsterPotID = 301;

    public static final int harpoonID = 311;

    public static final int coinsID = 995;

    // Getting time so we can check if we have been idle for awhile

    public long time = System.currentTimeMillis();

    // Items to drop when using power fishing and inventory is full

    public static final int[] dropThis = new int[] { 377, 359, 371 };



    public static final int[] bankWindows = new int[] { 2213 };



    public static final int[] BankCustoms = new int[] { 377, 376, 378 }; // All custom officers in port sarim, with them you can get to Karamja

    public static final int[] KaramjaCustoms = new int[] { 380 }; // All custom officers in karamja port, with them you can get to Port Sarim

    // Banks tile



    public boolean powerFish, fishHarpoon, dropTuna, dropSwordfish;



    public int startLevel = 0;

    public int startXP = 0;



    public int tunaBanked = 0;

    public int lobsterBanked = 0;

    public int swordfishBanked = 0;

    int tunaCount = 0;

    int lobsterCount = 0;

    int swordfishCount = 0;

    public long startTime = System.currentTimeMillis();



    int progress = 0;

    boolean walking = false;

    int randomTime = 0;

    boolean weAreOnKaramja = true;

    boolean sailinggp = false;



    public double getVersion() {

        return 1.81;

    }



    public String getName() {

        return "Karamja Fisher";

    }



    public String getScriptCategory() {

        return "Fishing";

    }





    public String getAuthor() {

        return "Linux_Communist";

    }



    public String getFixers() {

        return "veejay, samyyy123, mrz.";

    }





    public boolean onStart(Map<String, String> args) {



        switch(doWeHarpoon(args.get("what")))

        {

            case 1:    fishHarpoon = true;

                dropTuna = false;

                dropSwordfish = false;

                break;

            case 2: fishHarpoon = false;

                dropTuna = false;

                dropSwordfish = false;

                break;

            case 3: dropSwordfish = false;

                fishHarpoon = true;

                dropTuna = true;

                break;

            case 4: dropTuna = false;

                fishHarpoon = true;

                dropSwordfish = true;

                break;

            case 0: return false;

        }

        if(args.get("how").equals("power"))

            powerFish = true;

        else

            powerFish = false;



        if (args.get("sailingmoney").equals("take"))

            sailinggp = true;

        else sailinggp = false;



        lobsterBanked = 0;

        tunaBanked = 0;

        swordfishBanked = 0;

        startTime = System.currentTimeMillis();

        if(isLoggedIn()){

            startLevel = skills.getCurrentSkillLevel(10);

            startXP = skills.getCurrentSkillExp(10);

        }

        Bot.getEventManager().addListener(PaintListener.class, this);

        return true;

    }



    public void onFinish() {

        Bot.getEventManager().removeListener(PaintListener.class, this);

    }





    public int loop() {

        if(isLoggedIn() && startLevel == 0)

    {

        startLevel = skills.getCurrentSkillLevel(10);

        startXP = skills.getCurrentSkillExp(10);

    }



    switch(progress)

    {

        case 0: //Fishing part

                if(distanceTo(bankPath[0]) < 15) {

                    log("We are at the bank");

                    turnCamera();

                    weAreOnKaramja = false;

                    progress = 2;

                    return random(1000,2000);

                }



                if (!walking && dead()) // check if we are dead and not deathwalking

                {

                    log("Dead");

                    walking = true;

                    setRun(true);

                    return random(500, 1000);

                }

                if(walking) // Does deathwalk

                {

                    if(!getMyPlayer().isMoving())

                        doDeathWalk();

                    return random(500, 1000);

                }



                if (isInventoryFull() && !powerFish){ //If we bank and have inv full moves to next progress



                    if(dropTuna)

                        dropAllExcept(harpoonID,coinsID,swordfishID);

                    if(dropSwordfish)

                        dropAllExcept(harpoonID,coinsID,tunaID);

                    if(isInventoryFull())

                    {

                        progress++;

                        setRun(true);

                        return random(1000,1500);

                    }

                    return random(500,1000);

                } else if(isInventoryFull() && powerFish) // If we power and have inv full drops fish

                {

                    dropFish();

                }



                if(getMyPlayer().isInCombat()) // If we are in combat runs away

                {

                    runAway();

                    return random (400,700);

                }



                if(System.currentTimeMillis() - time < 30000+randomTime || getNearestNPCByID(405) != null)

                {

                    if (getMyPlayer().getAnimation() == 618 || getMyPlayer().getAnimation() == 619 || getMyPlayer().isMoving())

                    {

                        return random(350,500);

                    }

                }

                if(fishHarpoon)

                {

                    if(!inventoryContains(harpoonID))

                    {

                        if(getGroundItemByID(15, harpoonID) != null) {

                            RSItemTile item = getGroundItemByID(15, harpoonID);



                            if(item != null && !getMyPlayer().isMoving()) {

                                if(distanceTo(item) > 8) {

                                    walkTileMM(item);

                                    return random(1000,2000);

                                }



                                atTile(item, "Take");

                                return random(500, 1000);



                            } else

                                return random(500, 1000);

                        } else {

                            progress++;

                            return random(300,500);

                        }

                    }



                } else if(!fishHarpoon)

                {

                    if(!inventoryContains(lobsterPotID))

                    {

                        if(getGroundItemByID(15, lobsterPotID) != null) {

                            RSItemTile item = getGroundItemByID(15, lobsterPotID);



                            if(item != null && !getMyPlayer().isMoving()) {

                                if(distanceTo(item) > 8) {

                                    walkTileMM(item);

                                    return random(1000,2000);

                                }



                                atTile(item, "Take");

                                return random(500, 1000);



                            } else

                                return random(500,1000);

                        } else {

                            progress++;

                            return random(300,500);

                        }

                    }

                }

                fish(); // Lets fish

                randomTime = random(1000,20000); // Gets some random for the timer

                time = System.currentTimeMillis(); // resets timer

                return random(2000,3000);

        case 1:



                return walkToBank();

        case 2:

                weAreOnKaramja = false;

                RSObject bankWindow = findObject(bankWindows);

                turnCamera();

                if(distanceTo(bankWindow.getLocation()) > 5)

                {

                    walkTileMM(bankWindow.getLocation());

                    return random(500,750);

                }

                if(!interfaceExists(INTERFACE_BANK))

                {

                    atObject(bankWindow,"Use-quickly");

                    return random(1500,1750);

                }



                if(lobsterCount == 0)

                    lobsterCount = getInventoryCount(377);

                if(tunaCount == 0)

                    tunaCount = getInventoryCount(359);

                if(swordfishCount == 0)

                    swordfishCount = getInventoryCount(371);



                if(fishHarpoon){

                turnCamera();

                    bank.depositAllExcept(harpoonID, coinsID);}

                if(!fishHarpoon){

                turnCamera();

                    bank.depositAllExcept(lobsterPotID, coinsID);}



                if (sailinggp == true) { // If arguments said that we have to take 60gp for sailing, then we will take them

                    withdraw("Coins", coinsID, 60);

                }



                checkForTool();

                if(!isInventoryFull()) { // if inventory isnt full goes to second progress



                    lobsterBanked += lobsterCount;

                    lobsterCount = 0;

                    swordfishBanked += swordfishCount;

                    swordfishCount = 0;

                    tunaBanked += tunaCount;

                    tunaCount = 0;



                    progress++;

                }

                bank.close(); // close bank window



                return random(500,750);

        case 3:



                return walkToFishingSpot();

    }





        return random(500, 1000);



    }



    public boolean withdraw(String itemName, int itemID, int count) {

        bank.searchItem(itemName);

        wait(random(1000,2000));

        clickMouse(random(40, 60), random(100, 115), 1, 1, false);

        wait(random(250,500));

        if (count == 0) {

            atMenu("Withdraw-All");

            wait(random(200,300));

        }

        if (count == 1 || count == 5 || count == 10) {

            atMenu("Withdraw-" + count);

            wait(random(200,300));

        } else {

            atMenu("Withdraw-X");

            wait(random(800,1000));

            if(RSInterface.getInterface(INTERFACE_BANK_SEARCH).isValid()) {

                Bot.getInputManager().sendKeys("" + count, true);

                wait(random(700,800));

            }

        }

        wait(random(1000,2000));

        if (getInventoryCount(itemID) < 1) {

            log("Seems you don't have more " + itemName + ".");

            stopAllScripts();

        }

        wait(random(500,1000));

        clickMouse(random(301, 330), random(298, 317), 1, 1, true);

        wait(random(1000,2000));

        return true;

    }



    public int doWeHarpoon(String whatToFish) { // checks if argument contained n as in net or b as in bait

        if (whatToFish.contains("both"))

            return 1;

        else if (whatToFish.contains("lobster"))

            return 2;

        else if(whatToFish.contains("sword"))

            return 3;

        else if(whatToFish.contains("tuna"))

            return 4;

        else {

            log("To use this script give arguments either harpoon, tuna, lobster or swordfish for first and power or bank on second like \"harpoon,bank\"");

            return 0;

        }

    }



    public boolean dead() { // Are we dead ?



        return distanceTo(new RSTile(3232, 3219)) < 15;

    }



    public void doDeathWalk() { // doing deathwalk

        weAreOnKaramja = false;

        if (distanceTo(DEATH_PATH[DEATH_PATH.length-1]) < 10){

            walking = false;;



        } else

            walkPathMM(randomizePath(DEATH_PATH, 2, 2), 15);

    }



    public void dropFish() { // Dropping items that are set on dropThis array

        boolean drop = false;

        for(int i = 0; i < 27; i++)

        {

            for(int y = 0; y < dropThis.length; y++)

            {

                if(dropThis[y] == getInventoryItems()[i].getID()) {

                    drop = true;



                }

            }

            if(drop)

            {

                atInventoryItem(getInventoryItems()[i].getID(), "Drop");

                wait(random(1000,2000));

                drop = false;

            }



        }

    }



    public void drop(int id) {

        if(inventoryContains(id))

        {

            for(int i = 0; i < 27; i++)

            {

                if(getInventoryItems()[i].getID() == id)

                {

                    atInventoryItem(id, "Drop");

                    if(inventoryContains(id))

                        break;

                }

            }

        }

    }



    public void runAway() { // running away and running back after a while

        RSTile foo, bar;

        foo = getMyPlayer().getLocation();

        setRun(true);



        bar = new RSTile(foo.getX()-random(8,10),foo.getY()-random(8,10));



        walkTileMM(bar);

        wait(random(17000,20000));

        walkTileMM(foo);

    }





    public void fish() { // Fishing

        RSNPC spot = getNearestNPCByID(fishingSpots);

        if (spot == null || distanceTo(spot.getLocation()) > 25) {

            log("No (nearby) fishing spot. This sucks.");

        }

        else if (distanceTo(spot.getLocation()) > 4){

            walkTileMM(spot.getLocation());

        } else {

            weAreOnKaramja = true;

            if(fishHarpoon) atNPC(spot,"Harpoon");

            else if(!fishHarpoon) atNPC(spot,"Cage");

        }

    }



    public int walkToBank() {

        if (getMyPlayer().isMoving()) return random(250,500);
    RSTile Gangplank = new RSTile(3031, 3217);
    if (distanceTo(Gangplank) < 2){
        wait(random(6000,8000)); // Wait's 6-8 seconds till it will click on "Cross"

            if(atTile(Gangplank, "Cross"))

            {

                weAreOnKaramja = false;

                return random(2000,3000);

            }
    }
    RSTile onBoat = new RSTile(3032, 3217);

        if(distanceTo(shipToBank[0]) < 8) { weAreOnKaramja = false; }

        if(weAreOnKaramja)

        {

            if(distanceTo(karamjaPath[karamjaPath.length -1]) < 8){

                if(Bot.getClient().getInterfaceCache()[64] != null) {

                clickMouse(220+random(-77,60) ,455+random(-5,2), true); // Clicks on: Click here to continue // Interface: [64] [5]

                return random(1000,2000);

                } else if(Bot.getClient().getInterfaceCache()[228] != null) {

                clickMouse(260+random(-85,87) ,403+random(-5,3), true); // Clicks on: Can I journey on this ship? // Ok. // Interface: [228] [2]

                return random(1000,2000);

                } else if(Bot.getClient().getInterfaceCache()[230] != null) {

                clickMouse(260+random(-118,116) ,420+random(-6,5), true); // Clicks on: Search away, I have nothing to hide. // Interface: [230] [3]

                return random(1000,2000);

                } else if(Bot.getClient().getInterfaceCache()[241] != null) {

                clickMouse(310+random(-70,63) ,455+random(-7,1), true); // Clicks on: Click here to continue // Interface: [241] [5]

                return random(1000,2000);

                } else if(Bot.getClient().getInterfaceCache()[242] != null) {

                clickMouse(310+random(-73,65) ,455+random(-5,2), true); // Clicks on: Click here to continue // Interface: [242] [6]

                return random(1000,2000);

                } else {

                    RSNPC customs = getNearestNPCByID(KaramjaCustoms);

                    if(customs != null)

                    {

                        atNPC(customs, "Pay-Fare");

                        return random(1000,2000);

                    } else {



                    return random(1000,2000);

                    }

                }

            }



            walkPathMM(randomizePath(karamjaPath,2,2),12);

        } else

        {

            if (distanceTo(bankPath[0]) < 8){

                progress++;

                return random(500,750);

            }

            walkPathMM(randomizePath(shipToBank,2,2) ,15);

        }

        return random(3500,4000);

    }



    public int walkToFishingSpot() {

        if (getMyPlayer().isMoving()) return random(250,500);

        if(findObject(2082) != null) {

            wait(random(6000,8000)); // Wait's 6-8 seconds till it will click on "Cross"

            if(atObject(findObject(2082), "Cross"))

            {

                weAreOnKaramja = false;

                return random(2000,3000);

            } else return random(1000,2000);

        }

        if(distanceTo(shipToKaramja[0]) < 20) weAreOnKaramja = true;

        if(!weAreOnKaramja)

        {

            if(distanceTo(bankPath[bankPath.length -1]) < 8){

                if(Bot.getClient().getInterfaceCache()[64] != null) {

                clickMouse(220+random(-77,60) ,455+random(-5,2), true); // Clicks on: Click here to continue // Interface: [64] [5]

                return random(1000,2000);

                } else if(Bot.getClient().getInterfaceCache()[228] != null) {

                clickMouse(260+random(-28,33) ,403+random(-4,5), true); // Clicks on: Yes please.            // Interface: [228] [2]

                return random(1000,2000);

                } else if(Bot.getClient().getInterfaceCache()[241] != null) {

                clickMouse(310+random(-70,63) ,455+random(-7,1), true); // Clicks on: Click here to continue // Interface: [241] [5]

                return random(1000,2000);

                } else {

                    RSNPC customs = getNearestNPCByID(BankCustoms);

                    if(customs != null)

                    {

                        atNPC(customs, "Pay-Fare");

                        return random(1000,2000);

                    } else return random(1000,2000);

                }



            }

            walkPathMM(randomizePath(bankPath,2,2),15);

        } else

        {

            if (distanceTo(karamjaPath[0]) < 8){

                progress = 0;

                return random(500,750);

            }

            walkPathMM(randomizePath(shipToKaramja,2,2) ,18);

        }

        return random(3500,4000);



    }



    public void checkForTool() {

        boolean tool = false;

        if(fishHarpoon)

        {

            if(inventoryContains(harpoonID))

            {

                log("Have harpoon");

                tool = true;

            }

        } else if(!fishHarpoon)

        {

            if(inventoryContains(lobsterPotID))

            {

                log("Have lobster pot");

                tool = true;

            }

        }

        if(!tool)

        {

            log("No tool, taking one");

            //for(int i = 0; i < bank.getItemArray().length; i++) {

                if(!fishHarpoon)

                {



                    //if(bank.getItemArray()[i] == lobsterPotID)

                    //{

                        //withdraw("Coins", 995, 60);

                        withdraw("Lobster pot", lobsterPotID, 1);

                        //bank.atItem(lobsterPotID,"Withdraw 1");

                        tool = true;

                        log("Took lobster pot");

                    //}

                } else if(fishHarpoon)

                {

                    //if(bank.getItemArray()[i] == harpoonID)

                    //{

                        withdraw("Harpoon", 311, 1);

                        //bank.atItem(harpoonID,"Withdraw 1");

                        tool = true;

                        log("Took harpoon");

                    //}

                }

                //if(tool)

                //    break;

            //}

        }

    }

    public String getScriptDescription() {

        return "<html>\n" +

                "<head></head>\n" +

                "<body>\n" +

                    "<center>" +

                        "<h2>" + getName() + "</h2>" +

                    "</center>\n" +

                    "<b>Author:</b> " + getAuthor() + "<br />" +

                    "<b>Fixed by:</b> " + getFixers() + "<br />" +

                    "<b>Website:</b> <a href=\"http://www.chemfy.fi/\">http://www.chemfy.fi/</a><br />" +

                    "<b>Version:</b> " + getVersion() + "<br />" +



                    "<b>Features:</b>" +

                    "<ul><li>Can bank or power</li>" +

                    "<li>Can catch lobster, tuna, swordfish.</li>" +

                    "<li>Anti whirlpool, random combat, losing tools, logout.</li>" +

                    "<li>Shows fish banked and runtime.</li>" +

                    "<li>Deathwalk.</li></ul><br />" +



                    "<b>Arguments:<b><br />" +

                    "<form>Take 60gp for sailing each time:<input type=\"radio\" name=\"sailingmoney\" value=\"take\" checked=\"checked\"> yes " +

                    "<input type=\"radio\" name=\"sailingmoney\" value=\"notake\"> no<BR></form>" +

                    "<form>Bank:<input type=\"radio\" name=\"how\" value=\"bank\" checked=\"checked\"> " +

                    "Power:<input type=\"radio\" name=\"how\" value=\"power\"><br /></form>" +



                    "<form>Lobster:<input type=\"radio\" name=\"what\" value=\"lobster\" checked=\"checked\"> " +

                    "Tuna:<input type=\"radio\" name=\"what\" value=\"tuna\"> " +

                    "Swordfish:<input type=\"radio\" name=\"what\" value=\"swordfish\"> " +

                    "Tuna & Swordfish:<input type=\"radio\" name=\"what\" value=\"both\"><br /></form>" +





                "</body>\n" +

                "</html>";

    }



}

THANK YOU FOR THE SCRIPT!!!!!!, is there a .class file that it needs to use? or is this it?, again THANK YOU.
 
uhm i still get the error...and it says im using version 1.8V.....my guy goes through fishign and talkign and everything then the mouse clicks north (as if he was out/off of the ship) and just stands there, or i take control and make him cross the plank then it works fine...isnt there a quest u do and then u dont have to cross the plank?
 
Tenac Guild Miner v2.1!

URL: http://www.rsbot.org/mybb/showthread.php?tid=1262
Script Name: TenacGuildMiner.java
Script Author: Tenac

Code:
import java.awt.*;
import java.util.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;

import com.speljohan.rsbot.bot.*;
import com.speljohan.rsbot.script.*;
import com.speljohan.rsbot.accessors.*;
import com.speljohan.rsbot.script.wrappers.*;
import com.speljohan.rsbot.event.listeners.*;

public class TenacGuildMiner extends Script implements PaintListener {

    int[] bankerID = { 6200 };
    int[] bankBoothID = { 11758 };
        
    RSTile topLadderObjectTile = new RSTile(3019, 3339);
    int[] ladderID = { 30941 };
    int[] coalRockID = { 31068, 31069, 31070 };
    int[] mithRockID = { 31086, 31087, 31088 };

    int coalID = 453;
    int mithrilID = 447;
    int[] gemID = { 1617, 1619, 1621, 1623 };
    int[] pickaxeHandleID = { 466 };
    int[] pickaxeID = { 1265, 1267, 1269, 1273, 1271, 1275 };
    int[] pickaxeHeadID = { 480, 482, 484, 486, 488, 490 };
    int[] brokenPickaxeID =  { 468, 470, 472, 474, 476, 478 };
    
    int[] junkItems = { 1917, 1971 }; //beer, kebab
    int goldPiecesID = 995;

    RSTile lumbridgeTile = new RSTile(3221, 3218);

    RSTile bankTile = new RSTile(3014, 3356);
    RSTile[] betweenBankAndLadderTiles = { new RSTile(3019, 3351), new RSTile(3022, 3351), new RSTile(3024, 3352) };
    RSTile ladderTile = new RSTile(3021, 3341);
    //RSTile[] topLadderTiles = { new RSTile(3022, 3341), new RSTile(3022, 3337) };
    //RSTile[] bottomLadderTiles = { new RSTile(3021, 9741), new RSTile(3022, 9740) };

    RSTile[] coalToLadderPath = { new RSTile(3046, 9752), new RSTile(3044, 9745), new RSTile(3044, 9738),
                                  new RSTile(3037, 9737), new RSTile(3030, 9737), new RSTile(3020, 9739) };

    RSTile[] ladderToCoalPath = { new RSTile(3020, 9739), new RSTile(3030, 9737), new RSTile(3037, 9737),
                                  new RSTile(3044, 9738), new RSTile(3044, 9745), new RSTile(3046, 9752) };

    RSTile[] lumbridgeToFalidorPath = { new RSTile(3226, 3218), new RSTile(3233, 3220), new RSTile(3233, 3225),
                                        new RSTile(3231, 3230), new RSTile(3228, 3233), new RSTile(3223, 3238),
                                        new RSTile(3221, 3242), new RSTile(3219, 3247), new RSTile(3218, 3251),
                                        new RSTile(3217, 3256), new RSTile(3217, 3257), new RSTile(3217, 3261),
                                        new RSTile(3217, 3266), new RSTile(3216, 3272), new RSTile(3216, 3277),
                                        new RSTile(3210, 3280), new RSTile(3205, 3280), new RSTile(3204, 3279),
                                        new RSTile(3197, 3279), new RSTile(3190, 3282), new RSTile(3184, 3286),
                                        new RSTile(3178, 3287), new RSTile(3172, 3286), new RSTile(3165, 3285),
                                        new RSTile(3158, 3291), new RSTile(3149, 3296), new RSTile(3143, 3294),
                                        new RSTile(3137, 3295), new RSTile(3136, 3295), new RSTile(3130, 3295),
                                        new RSTile(3123, 3299), new RSTile(3118, 3296), new RSTile(3112, 3295),
                                        new RSTile(3106, 3295), new RSTile(3099, 3295), new RSTile(3094, 3292),
                                        new RSTile(3088, 3290), new RSTile(3082, 3289), new RSTile(3076, 3288),
                                        new RSTile(3074, 3284), new RSTile(3074, 3280), new RSTile(3069, 3277),
                                        new RSTile(3063, 3277), new RSTile(3057, 3276), new RSTile(3050, 3276),
                                        new RSTile(3047, 3276), new RSTile(3044, 3274), new RSTile(3037, 3277),
                                        new RSTile(3030, 3278), new RSTile(3024, 3276), new RSTile(3018, 3275),
                                        new RSTile(3013, 3276), new RSTile(3011, 3278), new RSTile(3007, 3284),
                                        new RSTile(3004, 3289), new RSTile(3007, 3294), new RSTile(3006, 3299),
                                        new RSTile(3004, 3304), new RSTile(3006, 3310), new RSTile(3007, 3316),
                                        new RSTile(3007, 3321), new RSTile(3005, 3326), new RSTile(3007, 3331),
                                         new RSTile(3007, 3332), new RSTile(3007, 3337), new RSTile(3007, 3343),
                                         new RSTile(3007, 3349), new RSTile(3005, 3355), new RSTile(3007, 3361),
                                         new RSTile(3012, 3361), new RSTile(3015, 3355) };

    long startTime = System.currentTimeMillis();
    int startingLevel = skills.getCurrentSkillLevel(STAT_MINING);
    int startingExperience = skills.getCurrentSkillExp(STAT_MINING);
    int oldExperience = 0;
    int ranAwayFromCombat = 0;
    int gemsBanked = 0;
    int coalBanked = 0;
    int mithBanked = 0;
    int gemsDropped = 0;
    int coalDropped = 0;
    int mithDropped = 0;
    int xpPerCoal = 50;
    int xpPerMithril = 80;
    int energyToRunAt = random(40, 90);

    boolean powermine = false;
    int invCountToDrop = random(10, 29);
    boolean dropping = false;
    
    boolean walkBack = false;
    boolean miningMith = false;
    boolean runAway = false;
    boolean needNewPick = false;

    int priceOfCoal = getMarketPriceOfItem(coalID);
    int priceOfMithril = getMarketPriceOfItem(mithrilID);

    public double getVersion() {
        return 2.1;
    }

    public String getName() {
        return "Tenac's Guild Miner";
    }

    public String getAuthor() {
        return "Tenac";
    }

    public String getScriptCategory() {
        return "Mining";
    }

    public String getScriptDescription( ) {
        String html = "";

        html += "<html>\n";
        html += "<body>\n";

        html += "<font size=\"6\">";
        html += "<center><h2>" + getName() + "</h2></center>\n";
        html += "</font>";

        html += "<b>Author:</b>" + getAuthor() + "<br/>";
        html += "<b>Version:</b>" + getVersion() + "<br/><br>";

        html += "Start anywhere with a pickaxe and at least 60 mining, preferably inside Falidor East bank or Mining Guild.<br>\n<br>";
        
        html += "<input type=\"checkbox\" name=\"mineMith\" value=\"yes\">Mine mithril rocks also?\n<br>";
        html += "<input type=\"checkbox\" name=\"powermine\" value=\"yes\">Drop ores?\n<br>";
        
        html += "</body>\n";
        html += "</html\n";

        return html;
    }

    public boolean onStart(Map<String, String> args) {
        startTime = System.currentTimeMillis();
        if(isLoggedIn()) {
            startingLevel = skills.getCurrentSkillLevel(STAT_MINING);
            startingExperience = skills.getCurrentSkillExp(STAT_MINING);
            setCameraAltitude(true);
            setCameraRotation(random(1, 359));
        }

        if(args.get("mineMith") != null)
            miningMith = true;

        if(args.get("powermine") != null)
            powermine = true;

        Bot.getEventManager().addListener(PaintListener.class, this);
        return true;
    }

    public void onFinish() {
        Bot.getEventManager().removeListener(PaintListener.class, this);
    }

    int height = 1;

    public void onRepaint(Graphics g) {
        if(isLoggedIn()) {
            if(startTime == 0)
                startTime = System.currentTimeMillis();

            if(startingLevel == 0 || startingExperience == 0) {
                startingLevel = skills.getCurrentSkillLevel(STAT_MINING);
            }

            long millis = System.currentTimeMillis() - startTime;
            long hours = millis / (1000 * 60 * 60);
            millis -= hours * (1000 * 60 * 60);
            long minutes = millis / (1000 * 60);
            millis -= minutes * (1000 * 60);
            long seconds = millis / 1000;

            g.setColor(new Color(33, 46, 207, 100));
            //window is (0, 0) (337, 515)
            //my box is (515 - 260, 0) (337, 200)
            int x = 515 - 230;
            int y = 4;
            g.fillRoundRect(x, y, 230, height, 20, 20);
            g.setColor(new Color(26, 36, 162, 255));
            g.drawRoundRect(x, y, 230, height, 20, 20);
            
            g.setColor(new Color(255, 255, 255, 255));
            g.drawString("Tenac's Guild Miner v" + getVersion(), x + 10, y += 15);
            g.drawString("Running for " + hours + ":" + minutes + ":" + seconds, x + 10, y += 15);
            if(powermine) {
                g.drawString("Dropped " + coalDropped + " coal", x + 10, y += 15);
                g.drawString("Dropped " + mithDropped + " mithril", x + 10, y += 15);
                g.drawString("Dropped " + gemsDropped + " gems", x + 10, y += 15);
            } else {
                g.drawString("Banked " + coalBanked + " coal", x + 10, y += 15);
                g.drawString("Banked " + mithBanked + " mithril", x + 10, y += 15);
                g.drawString("Banked " + gemsBanked + " gems", x + 10, y += 15);
            }
            if(!powermine) {
                g.drawString("Gained " + ((coalBanked * priceOfCoal) + (mithBanked * priceOfMithril)) + "gp", x + 10, y += 15);
                //averaging __gp per hour
            }
            g.drawString("Currently level " + skills.getCurrentSkillLevel(STAT_MINING) + " and " + skills.getPercentToNextLevel(STAT_MINING) + "% to next level", x + 10, y += 15);
            g.drawString("Gained " + (skills.getCurrentSkillLevel(STAT_MINING) - startingLevel) + " levels", x + 10, y += 15);
            //___ until level (skills.getCurrentSkillLevel(STAT_MINING) + 1)
            g.drawString("Gained " + (skills.getCurrentSkillExp(STAT_MINING) - startingExperience) + " experience", x + 10, y += 15);
            //averaging ____ experience per hour
            g.drawString("Ran from combat " + ranAwayFromCombat + " times", x + 10, y += 15);
            g.drawString("" + (int)(skills.getXPToNextLevel(STAT_MINING) / xpPerCoal + 1) + " more coal until next level", x + 10, y += 15);
            height = y + 3;
        }
    }

    public void printProgressReport() {
        if(startTime == 0)
            startTime = System.currentTimeMillis();
        if(startingLevel == 0 || startingExperience == 0) {
            startingLevel = skills.getCurrentSkillLevel(STAT_MINING);
            startingExperience = skills.getCurrentSkillExp(STAT_MINING);
        }
        long millis = System.currentTimeMillis() - startTime;
        long hours = millis / (1000 * 60 * 60);
        millis -= hours * (1000 * 60 * 60);
        long minutes = millis / (1000 * 60);
        millis -= minutes * (1000 * 60);
        long seconds = millis / 1000;
        log("Tenac's Guild Miner v" + getVersion());
        log("Running for " + hours + ":" + minutes + ":" + seconds);
        if(powermine) {
            log("Dropped " + coalDropped + " coal");
            log("Dropped " + mithDropped + " mithril");
            log("Dropped " + gemsDropped + " gems");
        } else {
            log("Banked " + coalBanked + " coal");
            log("Banked " + mithBanked + " mithril");
            log("Banked " + gemsBanked + " gems");
        }
        if(!powermine) {
            log("Gained " + ((coalBanked * priceOfCoal) + (mithBanked * priceOfMithril)) + "gp");
            //averaging __gp per hour
        }
        log("Currently level " + skills.getCurrentSkillLevel(STAT_MINING) + " and " + skills.getPercentToNextLevel(STAT_MINING) + "% to next level");
        log("Gained " + (skills.getCurrentSkillLevel(STAT_MINING) - startingLevel) + " levels");
        //___ until level (skills.getCurrentSkillLevel(STAT_MINING) + 1)
        log("Gained " + (skills.getCurrentSkillExp(STAT_MINING) - startingExperience) + " experience");
        //averaging ____ experience per hour
        log("Ran from combat " + ranAwayFromCombat + " times");
        log("" + (int)(skills.getXPToNextLevel(STAT_MINING) / xpPerCoal + 1) + " more coal until next level");
    }

    public int getMarketPriceOfItem(int id) {
        String pageSource = "";
        int begin = 0;
        int end = 0;
        try {
            URL theUrl = new URL("http://itemdb-rs.runescape.com/viewitem.ws?obj=" + id);
            URLConnection theUrlConnection = theUrl.openConnection();
            BufferedReader in = new BufferedReader(new InputStreamReader(theUrlConnection.getInputStream()));
            String inputLine = "";
            while ((inputLine = in.readLine()) != null)
                pageSource += inputLine;
            in.close();
            pageSource = pageSource.replaceAll("\n", "");
            pageSource = pageSource.replaceAll("\t", "");
            begin = pageSource.indexOf("<b>Market price:</b> ") + ("<b>Market price:</b> ").length();
            end = pageSource.indexOf("</span><span><b>Maximum price:</b>");
        } catch (Exception e) {
            System.out.println("Error obtaining price of http://itemdb-rs.runescape.com/viewitem.ws?obj=" + id);
        }
        return (int)new Integer(pageSource.substring(begin, end)).intValue();
    }

    public int loop() {
        if(!isLoggedIn())
            return random(500, 800);

        //if(getGroundItemByID(17, pickaxeHeadID) != null && (isCarryingItem(pickaxeHandleID)))
        if(getGroundItemByID(17, pickaxeHeadID) != null)
            return fixPickaxe();
        
        if(getEnergy() >= energyToRunAt) {
            energyToRunAt = random(40, 90);
            setRun(true);
        }
        
        if(getMyPlayer().isInCombat())
            runAway = true;
        
        if(runAway)
            return runAway();
        
        if(distanceTo(lumbridgeTile) <= 17)
            walkBack = true;

        if(isLost()) {
            if(myGetNextTile(lumbridgeToFalidorPath, 17) == null)
                return teleportToLumbridge();
            walkBack = true;
        }

        if(walkBack) {
            if(myWalkPath(lumbridgeToFalidorPath, 17, 1)) {
                walkBack = false;
                return depositInventory();
            }
        }

/*
        //will never be called since the  rsbot equipment interface is fucked up
        if(isCarryingItem(brokenPickaxeID) || isCarryingItem(pickaxeHandleID) || !isCarryingItem(pickaxeID))
            return getNewPick();
*/

        if(getInterface(211).isValid())
            if(getInterface(211).getChild(1).containsText("You need a Pickaxe") && getGroundItemByID(17, pickaxeHeadID) == null)
                needNewPick = true;
        
        if(needNewPick) {
            if(getNewPick() == 99999) {
                needNewPick = false;
                return random(10, 20);
            } else {
                return random(10, 20);
            }
        }

        if(isCarryingJunk())
            return dropJunk();

        if(canEquipPickaxe())
            return wieldPickaxe();

        if(powermine && (getInventoryCount() >= invCountToDrop || isInventoryFull()))
            dropping = true;

        if(dropping)
            return dropInventory();

        if(isInventoryFull() && !powermine)
            return depositInventory();

        if(isInventoryFull())
            return depositInventory();

        return mineCoal();
    }

    public boolean isLost() {
        if(distanceTo(lumbridgeTile) <= 17)
                return false;
        if(distanceTo(bankTile) <= 17)
            return false;
        if(distanceTo(ladderTile) <= 17)
            return false;
        for(int i = 0; i < betweenBankAndLadderTiles.length - 1; i++)
            if(distanceTo(betweenBankAndLadderTiles[i]) <= 17)
                    return false;
        for(int i = 0; i < coalToLadderPath.length - 1; i++)
            if(distanceTo(coalToLadderPath[i]) <= 17)
                    return false;
        return true;
    }

    public int dropInventory() {
        if(atInventoryItem(coalID, "Drop")) {
            coalDropped++;
            wait(random(500, 700));
            return random(50, 75);
        } else if(atInventoryItem(mithrilID, "Drop")) {
            mithDropped++;
            wait(random(500, 700));
            return random(50, 75);
        }
        for(int i = 0; i < gemID.length; i++) {
            if(atInventoryItem(gemID[i], "Drop")) {
                gemsDropped++;
                wait(random(500, 700));
                return random(50, 75);
            }
        }
        dropping = false;
        invCountToDrop = random(10, 29);
        return random(50, 75);
    }

    public boolean isCarryingJunk() {
        for(int i = 0; i < junkItems.length; i++) {
            if(inventoryContainsOneOf(junkItems[i])) {
                return true;
            }
        }
        RSItem item = getInventoryItemByID(goldPiecesID);
        if(item != null) {
            if(item.getStackSize() <= 5000) {
                return true;
            }
        }
        return false;
    }
    
    public int dropJunk() {
        for(int i = 0; i < junkItems.length; i++) {
            if(inventoryContainsOneOf(junkItems[i])) {
                if(atInventoryItem(junkItems[i], "Drop"))
                    return random(550, 700);
            }
        }
        RSItem item = getInventoryItemByID(goldPiecesID);
        if(item != null) {
            if(item.getStackSize() <= 5000) {
                if(atInventoryItem(goldPiecesID, "Drop"))
                    return random(550, 700);
            }
        }
        return random(40, 100);
    }
    
    public void unequipWeapon() {
        openTab(TAB_EQUIPMENT);
        RSInterface equip = RSInterface.getInterface(INTERFACE_TAB_EQUIPMENT);
        RSInterfaceChild weapon = equip.getChild(16);
        atInterface(weapon);
        wait(random(400, 800));
        openTab(TAB_INVENTORY);
    }

    public int runAway() {
        log("Running away from combat...");
        setRun(true);
        if(getMyPlayer().getLocation().getY() > 6000) {
            if(!myWalkPath(coalToLadderPath, 17, 2))
                return random(200, 300);
            waitUntilNotMoving();
            if(!climbUpLadder())
                climbUpLadder();
            wait(random(2200, 3400));
        } else {
            RSTile curentTile = getMyPlayer().getLocation();
            int xRand = random(-16, 17);
            int yRand;
            if(random(0, 2) == 0)
                yRand = -(int)(Math.sqrt((16 * 16) - (xRand * xRand)));
            else
                yRand = -(int)(Math.sqrt((16 * 16)- (xRand * xRand)));
            RSTile runawayTile = new RSTile(curentTile.getX() + xRand, curentTile.getY() + yRand);
            myWalkTile(runawayTile, 0);
            waitUntilNearTile(runawayTile, 0);
            wait(random(2200, 3400));
            myWalkTile(curentTile, 1);
            wait(random(50, 600));
            if(random(0, 4) < 3)
                moveMouse(random(100, 415), random(100, 237));
            waitUntilNotMoving();
        }
        runAway = false;
        ranAwayFromCombat++;
        log("Combat evaded.");
        return random(50, 100);
    }

    long upLadderTimer = System.currentTimeMillis();

    public boolean climbUpLadder() {
        upLadderTimer = System.currentTimeMillis();
        RSObject object = getNearestObjectById(16, ladderID);
        if(object == null)
            return false;
        if(!Calculations.onScreen(Calculations.tileToScreen(object.getLocation()))) {
            myWalkTile(object.getLocation(), 2);
            wait(random(50, 600));
            if(random(0, 4) < 3)
                moveMouse(random(100, 415), random(100, 237));
            waitUntilNotMoving();
        }
        if(atObject(object, "up")) {
            while(getMyPlayer().getLocation().getY() > 6000 && System.currentTimeMillis() - upLadderTimer < 6000) {
                if(getMyPlayer().getLocation().getY() < 6000)
                    return true;
                if(System.currentTimeMillis() - upLadderTimer >= 6000)
                    return false;
                wait(random(600, 800));
            }
        } else {
            setCameraRotation(random(1, 359));
            //setCameraAltitude(true);
        }
        return false;
    }

    public boolean atTileModified(RSTile tile, String action) {
        try {
            Point location = Calculations.tileToScreen(tile);
            if (location.x == -1 || location.y == -1) return false;
            int xRand = 0;
            int yRand = 0;
            if(random(0, 2) == 0)
                xRand = random(-26, -16);
            else
                xRand = random(16, 26);
            if(random(0, 2) == 0)
                yRand = random(-26, -16);
            else
                yRand = random(16, 26);
            moveMouse(location, xRand, yRand);
            if (getMenuItems().get(0).toLowerCase().contains(action.toLowerCase())) {
                clickMouse(true);
            } else {
                clickMouse(false);
                if(!atMenu(action))
                    return false;
            }
            waitUntilNotMoving();
            return true;
        } catch (Exception e) {
            return false;
        }
    }

    long downLadderTimer = System.currentTimeMillis();

    public boolean climbDownLadder() {
        downLadderTimer = System.currentTimeMillis();
        if(!Calculations.onScreen(Calculations.tileToScreen(topLadderObjectTile)))
            return false;
        if(atTileModified(topLadderObjectTile, "down")) {
            while(getMyPlayer().getLocation().getY() < 6000 && System.currentTimeMillis() - downLadderTimer < 6000) {
                if(getMyPlayer().getLocation().getY() > 6000)
                    return true;
                if(System.currentTimeMillis() - downLadderTimer >= 6000)
                    return false;
                wait(random(600, 800));
            }
        } else {
            //if(distanceTo(ladderTile) > 6)
            //    myWalkTile(ladderTile, 2);
            setCameraRotation(random(1, 359));
            //setCameraAltitude(true);
            //waitUntilNearTile(ladderTile, 0);
        }
        return false;
    }

    public int getNewPick() {
        if(getMyPlayer().getLocation().getY() > 6000) {
            if(myWalkPath(coalToLadderPath, 15, 3)) {
                waitUntilNotMoving();
                climbUpLadder();
            }
            return random(100, 200);
        }
        if(distanceTo(bankTile) > 4) {
            if(myWalkTile(bankTile, 1)) {
                wait(random(50, 600));
                if(random(0, 4) < 3)
                    moveMouse(random(100, 415), random(100, 237));
                waitUntilNotMoving();
            } else {
                RSTile theTile = betweenBankAndLadderTiles[random(0, betweenBankAndLadderTiles.length)];
                myWalkTile(theTile, 1);
                if(random(0, 2) == 0)
                    setCameraAltitude(true);
                waitUntilNearTile(theTile, 2);
            }
            return random(200, 300);
        }
        if(!RSInterface.getInterface(INTERFACE_BANK).isValid()) {
            int r = random(0, 2);
            if(r == 0)
                if(!atObject(getNearestObjectById(15, bankBoothID), "uickl"))
                    myWalkTile(bankTile, 2);
            if(r == 1)
                if(!atNPC(getNearestNPCByID(bankerID), "ank Ba"))
                    myWalkTile(bankTile, 2);
            wait(random(200, 300));
            waitUntilNotMoving();
            return random(100, 300);
        }
        if(RSInterface.getInterface(INTERFACE_BANK).isValid()) {
            coalBanked += getInventoryCount(coalID);
            mithBanked += getInventoryCount(mithrilID);
            gemsBanked += getInventoryCount(gemID);
            bank.depositAll();

            moveMouse(52 + random(-10, 10), 106 + random(-10, 10));
            if(getMenuItems().get(0).toLowerCase().contains(("pickaxe").toLowerCase()) && !getMenuItems().get(0).toLowerCase().contains(("Broken").toLowerCase())) {
                clickMouse(true);
                wait(random(1100, 1500));
            } else {
                log("No useable pickaxe, ending script =(");
                bank.close();
                printProgressReport();
                stopAllScripts();
            }
            bank.close();
        }
        return 99999;
    }

    int headAttempts;
    public int fixPickaxe() {
        RSItemTile head = getGroundItemByID(17, pickaxeHeadID);
        if(head != null) {
            log("Getting pickaxe head...");
            myWalkTile(head, 1);
            waitUntilNearTile(head, 0);
            headAttempts = 0;
            while(!atTile(head, "Take") || headAttempts <= 10) {
                setCameraRotation(random(1, 359));
                if(random(0, 3) == 0)
                    atTile(randomizeTile(head, 1, 1), "Walk");
                headAttempts++;
                
            }
        }
        //if(equipmentContains(pickaxeHandleID) || equipmentContains(brokenPickaxeID))
            unequipWeapon();
        openTab(TAB_INVENTORY);
        wait(random(200, 300));
        if(getInventoryItemByID(pickaxeHeadID) != null && getInventoryItemByID(pickaxeHandleID) != null)
            useItem(getInventoryItemByID(pickaxeHeadID), getInventoryItemByID(pickaxeHandleID));

        if(skills.getCurrentSkillLevel(STAT_ATTACK) >= 40 && inventoryContainsOneOf(pickaxeID[5]))
            atInventoryItem(pickaxeID[5], "ield");
        else if(skills.getCurrentSkillLevel(STAT_ATTACK) >= 30 && inventoryContainsOneOf(pickaxeID[4]))
            atInventoryItem(pickaxeID[4], "ield");
        else if(skills.getCurrentSkillLevel(STAT_ATTACK) >= 20 && inventoryContainsOneOf(pickaxeID[3]))
            atInventoryItem(pickaxeID[3], "ield");
        else if(skills.getCurrentSkillLevel(STAT_ATTACK) >= 5 && inventoryContainsOneOf(pickaxeID[2]))
            atInventoryItem(pickaxeID[2], "ield");
        else if(skills.getCurrentSkillLevel(STAT_ATTACK) >= 1 && inventoryContainsOneOf(pickaxeID[1]))
            atInventoryItem(pickaxeID[1], "ield");
        else if(skills.getCurrentSkillLevel(STAT_ATTACK) >= 1 && inventoryContainsOneOf(pickaxeID[0]))
            atInventoryItem(pickaxeID[0], "ield");
        return random(200, 400);
    }

    public boolean canEquipPickaxe() {
        if((skills.getCurrentSkillLevel(STAT_ATTACK) >= 40 && inventoryContainsOneOf(pickaxeID[5])) ||
           (skills.getCurrentSkillLevel(STAT_ATTACK) >= 30 && inventoryContainsOneOf(pickaxeID[4])) ||
           (skills.getCurrentSkillLevel(STAT_ATTACK) >= 20 && inventoryContainsOneOf(pickaxeID[3])) ||
           (skills.getCurrentSkillLevel(STAT_ATTACK) >= 5 && inventoryContainsOneOf(pickaxeID[2])) ||
           (skills.getCurrentSkillLevel(STAT_ATTACK) >= 1 && inventoryContainsOneOf(pickaxeID[1])) ||
           (skills.getCurrentSkillLevel(STAT_ATTACK) >= 1 && inventoryContainsOneOf(pickaxeID[0])))
            return true;
        return false;
    }
    
    public int wieldPickaxe() {
        if(RSInterface.getInterface(INTERFACE_BANK).isValid())
            bank.close();

        if(skills.getCurrentSkillLevel(STAT_ATTACK) >= 40 && inventoryContainsOneOf(pickaxeID[5]))
            atInventoryItem(pickaxeID[5], "ield");
        else if(skills.getCurrentSkillLevel(STAT_ATTACK) >= 30 && inventoryContainsOneOf(pickaxeID[4]))
            atInventoryItem(pickaxeID[4], "ield");
        else if(skills.getCurrentSkillLevel(STAT_ATTACK) >= 20 && inventoryContainsOneOf(pickaxeID[3]))
            atInventoryItem(pickaxeID[3], "ield");
        else if(skills.getCurrentSkillLevel(STAT_ATTACK) >= 5 && inventoryContainsOneOf(pickaxeID[2]))
            atInventoryItem(pickaxeID[2], "ield");
        else if(skills.getCurrentSkillLevel(STAT_ATTACK) >= 1 && inventoryContainsOneOf(pickaxeID[1]))
            atInventoryItem(pickaxeID[1], "ield");
        else if(skills.getCurrentSkillLevel(STAT_ATTACK) >= 1 && inventoryContainsOneOf(pickaxeID[0]))
            atInventoryItem(pickaxeID[0], "ield");
        return random(200, 400);
    }

    public int depositInventory() {
        if(getMyPlayer().getLocation().getY() > 6000) {
            if(myWalkPath(coalToLadderPath, 15, 3)) {
                waitUntilNotMoving();
                climbUpLadder();
            }
            return random(100, 200);
        }
        if(distanceTo(bankTile) > 4) {
            if(myWalkTile(bankTile, 1)) {
                wait(random(50, 600));
                if(random(0, 4) < 3)
                    moveMouse(random(100, 415), random(100, 237));
                waitUntilNotMoving();
            } else {
                RSTile theTile = betweenBankAndLadderTiles[random(0, betweenBankAndLadderTiles.length)];
                myWalkTile(theTile, 1);
                if(random(0, 2) == 0)
                    setCameraAltitude(true);
                waitUntilNearTile(theTile, 2);
            }
            return random(200, 300);
        }
        if(!RSInterface.getInterface(INTERFACE_BANK).isValid()) {
            int r = random(0, 2);
            if(r == 0)
                if(!atObject(getNearestObjectById(15, bankBoothID), "uickl"))
                    myWalkTile(bankTile, 2);
            if(r == 1)
                if(!atNPC(getNearestNPCByID(bankerID), "ank Ba"))
                    myWalkTile(bankTile, 2);
            wait(random(200, 300));
            waitUntilNotMoving();
            return random(200, 300);
        }
        if(RSInterface.getInterface(INTERFACE_BANK).isValid()) {
            coalBanked += getInventoryCount(coalID);
            mithBanked += getInventoryCount(mithrilID);
            gemsBanked += getInventoryCount(gemID);
            bank.depositAllExcept(pickaxeID);
            if(random(0, 5) == 0)
                bank.close();
        }
        return random(25, 100);
    }

    public void mouseOverMiningSkill() {
        openTab(TAB_STATS);
        //2 interfaces, one for the pickaxe image, other for the skill text
        RSInterfaceChild one = RSInterface.getInterface(320).getChild(9);
        RSInterfaceChild two = RSInterface.getInterface(320).getChild(10);
        if(random(0, 2) == 0)
            moveMouse(new Point(one.getAbsoluteX() + random(2, one.getWidth() - 1), one.getAbsoluteY() + random(2, one.getHeight() - 1)));
        else
            moveMouse(new Point(two.getAbsoluteX() + random(2, two.getWidth() - 1), two.getAbsoluteY() + random(2, two.getHeight() - 1)));
    }

    //4% chance of doing antiban: 17/425, every 4.8-19.2 seconds doing antiban
    public int antiBan() {
        switch(random(0, 425)) {
            case 0: setCameraRotation(random(1, 359)); break;
            case 1: setCameraRotation(random(1, 359)); break;
            case 2: setCameraRotation(random(1, 359)); break;
            case 3: setCameraRotation(random(1, 359)); break;
            case 4: setCameraRotation(random(1, 359)); break;
            case 5: setCameraRotation(random(1, 359)); break;

            case 6: setRun(true); break;

            case 7: moveMouse(random(0, 515), random(0, 337)); break;
            case 8: moveMouse(random(0, 515), random(0, 337)); break;
            case 9: moveMouse(random(100, 415), random(100, 237)); break;
            case 10: moveMouse(random(100, 415), random(100, 237)); break;
            case 11: moveMouse(random(100, 415), random(100, 237)); break;
            case 12: moveMouse(random(0, 764), random(0, 502)); break;

            case 13: mouseOverMiningSkill(); break;
            case 14: mouseOverMiningSkill(); break;

            case 15: openTab(TAB_INVENTORY); break;
            case 16: openTab(random(0, 13)); break;

            default: break;
        }
        return random(50, 200);
    }

    RSTile lastRockLocation = new RSTile(0000, 0000);
    RSObject rock;
    long timeIdle = System.currentTimeMillis();

    public boolean mineNewRock() {
        RSObject obj = getObjectAt(lastRockLocation);
        if(obj == null)
            return true;
        for(int i = 0; i < coalRockID.length; i++) {
            if(obj.getID() == coalRockID[i])
                return false;
        }
        for(int i = 0; i < mithRockID.length; i++) {
            if(obj.getID() == mithRockID[i])
                return false;
        }
        return true;
    }

    public boolean atRock(RSObject obj) {
        try {
            Point location = Calculations.tileToScreen(obj.getLocation());
            if (location.x == -1 || location.y == -1) return false;
            moveMouse(location, 3, 3);
            wait(random(40, 80));
            boolean validRock = false;
            RSObject temp = getObjectAt(obj.getLocation());
            if(temp != null) {
                int id = temp.getID();
                for(int i = 0; i < coalRockID.length; i++) {
                    if(id == coalRockID[i])
                        validRock = true;
                }
                if(!validRock) {
                    for(int i = 0; i < mithRockID.length; i++) {
                        if(id == mithRockID[i])
                            validRock = true;
                    }
                }
            }
            if(!validRock)
                return false;
            if(!getMenuItems().get(0).toLowerCase().contains(("ine R").toLowerCase())) {
                moveMouse(location, 6, 6);
                wait(random(40, 80));
                if(!getMenuItems().get(0).toLowerCase().contains(("ine R").toLowerCase())) {
                    moveMouse(location, 6, 6);
                    wait(random(40, 80));
                    if(!getMenuItems().get(0).toLowerCase().contains(("ine R").toLowerCase())) {
                        moveMouse(location, 6, 6);
                        wait(random(40, 80));
                    }
                }
            }
                
            if(getMenuItems().get(0).toLowerCase().contains(("ine R").toLowerCase())) {
                clickMouse(true);
            } else {
                clickMouse(false);
                if(!atMenu("ine R"))
                    return false;
            }
            wait(random(500, 1000));
            waitUntilNotMoving();
            return true;
        } catch (Exception e) {
            return false;
        }
    }

    private boolean isObjectOccupied(RSObject obj) {
        Player[] players = Bot.getClient().getPlayerArray();
        int[] playerIndex = Bot.getClient().getPlayerIndexArray();
        if(obj.getLocation() == null)
            return true;
        for(int element : playerIndex) {
            if(players[element] == null)
                continue;
            RSPlayer player = new RSPlayer(players[element]);
            if(!player.getName().equals(getMyPlayer().getName()))
                if(distanceBetween(obj.getLocation(), player.getLocation()) < 2 && player.getAnimation() != -1)
                    return true;
        }
        return false;
    }

    private RSObject findNearestUnoccupiedObject(RSObject... objects) {
        RSObject nearestObj = null;
        for(int i = 0; i < objects.length; i++) {
            if(isObjectOccupied(objects[i]))
                continue;
            if(nearestObj == null)
                nearestObj = objects[i];
            else if(distanceTo(objects[i].getLocation()) < distanceTo(nearestObj.getLocation()))
                nearestObj = objects[i];
        }
        return nearestObj;
    }

    public int mineCoal() {
        if(getMyPlayer().getLocation().getY() < 6000) {
            if(!climbDownLadder()) {
                if(Calculations.onScreen(Calculations.tileToScreen(topLadderObjectTile)))
                    return random(20, 80);
                if(myWalkTile(ladderTile, 2)) {
                    if(random(0, 4) < 3)
                        moveMouse(random(100, 415), random(100, 237));
                    waitUntilNearTile(ladderTile, 0);
                } else {
                    RSTile theTile = betweenBankAndLadderTiles[random(0, betweenBankAndLadderTiles.length)];
                    myWalkTile(theTile, 1);
                    if(random(0, 2) == 0)
                        setCameraAltitude(true);
                    waitUntilNearTile(theTile, 2);
                }
                return random(200, 300);
            }
            return random(200, 400);
        }

        if(getMyPlayer().getAnimation() != -1)
            timeIdle = System.currentTimeMillis();
        
        if(getObjectAt(lastRockLocation) == null)
            lastRockLocation = new RSTile(0000, 0000);

        if(mineNewRock() || ((getMyPlayer().getAnimation() == -1) && (System.currentTimeMillis() - timeIdle >= 4000) && !getMyPlayer().isMoving())) {
            rock = null;
            if(miningMith && (findNearestUnoccupiedObject(findObjects(16, mithRockID)) != null || getNearestObjectById(16, mithRockID) != null)) {
                if(findNearestUnoccupiedObject(findObjects(16, mithRockID)) != null)
                    rock = findNearestUnoccupiedObject(findObjects(16, mithRockID));
                else
                    rock = getNearestObjectById(16, mithRockID);
            } else {
                if(findNearestUnoccupiedObject(findObjects(10, coalRockID)) != null)
                    rock = findNearestUnoccupiedObject(findObjects(10, coalRockID));
                else
                    rock = getNearestObjectById(16, coalRockID);
            }
            if(rock == null) {
                if(distanceTo(ladderToCoalPath[ladderToCoalPath.length - 1]) < 6) {
                    myWalkPath(coalToLadderPath, 15, 3);
                    wait(random(50, 600));
                    if(random(0, 4) < 3)
                        moveMouse(random(100, 415), random(100, 237));
                    waitUntilNotMoving();
                    return random(50, 200);
                }
                if(distanceTo(coalToLadderPath[coalToLadderPath.length - 1]) < 6) {
                    myWalkPath(ladderToCoalPath, 15, 3);
                    wait(random(50, 600));
                    if(random(0, 4) < 3)
                        moveMouse(random(100, 415), random(100, 237));
                    waitUntilNotMoving();
                    return random(50, 200);
                }
                if(random(0, 2) == 0)
                    myWalkPath(ladderToCoalPath, 17, 3);
                else
                    myWalkPath(coalToLadderPath, 17, 3);

                wait(random(50, 600));
                if(random(0, 4) < 3)
                    moveMouse(random(100, 415), random(100, 237));
                waitUntilNotMoving();
                return random(50, 200);
            }
            if(rock.getLocation().getY() > 9756) {
                myWalkPath(coalToLadderPath, 17, 3);
                waitUntilNotMoving();
                lastRockLocation = new RSTile(0000, 0000);
                return random(50, 200);
            }
            //if(!tileOnScreen(rock.getLocation())) {
            if(!Calculations.onScreen(Calculations.tileToScreen(rock.getLocation()))) {
                if(!myWalkTile(rock.getLocation(), 2)) {
                    lastRockLocation = new RSTile(0000, 0000);
                    return random(20, 40);
                }
                if(random(0, 4) == 0)
                    setCameraAltitude(true);
                wait(random(50, 200));
                if(random(0, 4) < 3)
                    moveMouse(random(100, 415), random(100, 237));
                waitUntilNotMoving();
                return random(50, 200);
            }
            lastRockLocation = rock.getLocation();
            if(!atRock(rock))
                setCameraRotation(random(1, 359));

            return random(100, 300);
        }
        return antiBan();
    }

    int tries = 0;
    public int teleportToLumbridge() {
        if(distanceTo(lumbridgeTile) > 17) {
            castSpell(1);
            wait(random(1500, 2400));
            if(getMyPlayer().getAnimation() != -1) {
                wait(random(12500,14000));
            } else {
                tries++;
                if(tries >= 4) {
                    log("Unable to teleport to lumbridge, stopping script");
                    printProgressReport();
                    stopAllScripts();
                }
                int r = random(120000, 400000);
                log("Unable to teleport to lumbridge, will attempt again in " + (r / 1000) + "seconds");
                printProgressReport();
                logout();
                wait(r);
                login();
            }
        }
        myWalkTile(lumbridgeTile, 1);
        setRun(true);
        waitUntilNearTile(lumbridgeTile, 2);
        return random(100, 600);
    }

    public void waitUntilNotMoving() {
        wait(random(700, 1000));
        while(getMyPlayer().isMoving())
            wait(random(25, 100));
    }

    public void waitUntilNearTile(RSTile tile, int dist) {
        wait(random(700, 1000));
        while(distanceTo(tile) >= dist && getMyPlayer().isMoving())
            wait(random(25, 100));
    }

    public boolean myWalkTile(RSTile theTile, int randomness) {
        if(theTile == null)
            return false;
        if((distanceTo(theTile)) <= 17) {
            RSTile newTile;
            if(randomness == 0)
                newTile = new RSTile(theTile.getX(), theTile.getY());
            else
                newTile = new RSTile(theTile.getX() + random(-randomness, randomness + 1), theTile.getY() + random(-randomness, randomness + 1));

            if(random(0, 30) == 0)
                turnToTile(newTile, 15);

            if(tileOnScreen(newTile) && random(0, 10) == 0) {
                if(!atTile(newTile, "Walk")) {
                    if(!walkTileMM(newTile)) {
                        //log("Failed walking to tile: (" + theTile.getX() + ", " + theTile.getY() + ")");
                        return false;
                    } else {
                        return true;
                    }
                } else {
                    return true;
                }
            } else {
                if(!walkTileMM(newTile)) {
                    //log("Failed walking to tile: (" + theTile.getX() + ", " + theTile.getY() + ")");
                    return false;
                } else {
                    return true;
                }
            }
        } else {
            //log("Tile out of reach: (" + theTile.getX() + ", " + theTile.getY() + ")");
            return false;
        }
    }

    public RSTile myGetNextTile(RSTile[] path, int maxDist) {
        for(int i = path.length - 1; i >= 0; i--) {
            if(distanceTo(path[i]) <= maxDist) {
                return path[i];
            }
        }
        return null;
    }

    /**
     * Walks to the next reachable tile in the path
     *
     * @param path The path it will walk
     * @param maxDist The max distance it will search for the next tile in the path
     * @param randomness the randomness it will add to clicking the tile
     * @return if you are within 4 tiles of the destination
     */
    public boolean myWalkPath(RSTile[] path, int maxDist, int randomness) {
        if(distanceTo(path[path.length - 1]) <= 4) {
            return true;
        } else {
            RSTile theTile = myGetNextTile(path, maxDist);
            if(theTile != null) {
                myWalkTile(theTile, randomness);
                waitUntilNearTile(theTile, 2);
            }
            return false;
        }
    }

    public RSObject getNearestObjectById(int range, int... ids) {
        for(int i = 0; i <= range; i++) {
            RSObject temp = findObject(i, ids);
            if(temp != null) {
                return temp;
            }
        }
        return null;
    }

    public RSObject[] findObjects(int range, int... ids) {
        ArrayList<RSObject> matches = new ArrayList<RSObject>();
        RSTile pos = getMyPlayer().getLocation();
        int xBegin = pos.getX() - range;
        int yBegin = pos.getY() - range;
        int xEnd = pos.getX() + range;
        int yEnd = pos.getY() + range;
        for (int x = xBegin; x < xEnd; x++) {
            for (int y = yBegin; y < yEnd; y++) {
                RSTile t = new RSTile(x, y);
                RSObject obj = getObjectAt(t);
                if (obj == null)
                    continue;
                for (int objType : ids) {
                    if (objType == obj.getID())
                        matches.add(obj);
                }
            }
        }
        try {
            matches.trimToSize();
            return (RSObject[]) matches.toArray(new RSObject[matches.size()]);
        } catch (Exception e) { }
        return new RSObject[0];
    }

}
will you please upload this at the end of the month (download link to tenac guild miner does not work fix with my versoin of tenac plz?)
 
Can someone post an F2P clay softener? The edgeville one I have stops after filling the bucket with water.
 
Status
Not open for further replies.
duelarena.gg
Back
Top