All Smelter Script?

Discussion in 'Archives' started by apolamalufan, Jan 3, 2009.

Thread Status:
Not open for further replies.
All Smelter Script?
  1. Unread #1 - Jan 3, 2009 at 12:49 PM
  2. apolamalufan
    Joined:
    Dec 13, 2008
    Posts:
    20
    Referrals:
    0
    Sythe Gold:
    0

    apolamalufan Newcomer

    All Smelter Script?

    i have 1500 coal and 300 mith ore i put in 1800 when it asks mehow many ores i have that didnt work so i put in 300 that didnt work then 1500 that also didnt work what am i doing wrong or can someone give me the best smelter to use
     
  3. Unread #2 - Jan 3, 2009 at 1:21 PM
  4. crapkiller
    Joined:
    Jul 19, 2006
    Posts:
    426
    Referrals:
    0
    Sythe Gold:
    0

    crapkiller Forum Addict

    All Smelter Script?

    Ive used this script before, and it works fine. You should put in 300 ores, and you have to be more specific of how it didnt work. Did it give an error? Where are you starting... etc.
     
  5. Unread #3 - Jan 3, 2009 at 1:30 PM
  6. apolamalufan
    Joined:
    Dec 13, 2008
    Posts:
    20
    Referrals:
    0
    Sythe Gold:
    0

    apolamalufan Newcomer

    All Smelter Script?

    no it didnt say a error or anything i deleted all the scripts from my script folder and add only ones im going to use. i put my coal in the first bank slot and mith in the second and all it does is withdraw coal and keeps doing it is that the problem
     
  7. Unread #4 - Jan 3, 2009 at 2:57 PM
  8. crapkiller
    Joined:
    Jul 19, 2006
    Posts:
    426
    Referrals:
    0
    Sythe Gold:
    0

    crapkiller Forum Addict

    All Smelter Script?

    I remember having a similar problem, What i did is restart the script a few times, make sure your bank isnt set on Notes. And eventually you will get it going.
     
  9. Unread #5 - Jan 3, 2009 at 3:21 PM
  10. gridfun
    Joined:
    Jan 3, 2006
    Posts:
    43
    Referrals:
    0
    Sythe Gold:
    0

    gridfun Member

    All Smelter Script?

    Save it as AlKharidSmelter.java into youre scripts folder:)
    You will found it under 'Smelting'


    Code:
    import java.applet.Applet;
    import java.awt.Color;
    import java.awt.FlowLayout;
    import java.awt.Graphics;
    import java.awt.Point;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.MouseEvent;
    import java.util.ArrayList;
    import java.util.Map;
    
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JTextField;
    
    import com.speljohan.rsbot.bot.Bot;
    import com.speljohan.rsbot.event.events.ServerMessageEvent;
    import com.speljohan.rsbot.event.listeners.PaintListener;
    import com.speljohan.rsbot.event.listeners.ServerMessageListener;
    import com.speljohan.rsbot.script.Constants;
    import com.speljohan.rsbot.script.Script;
    import com.speljohan.rsbot.script.wrappers.RSInterface;
    import com.speljohan.rsbot.script.wrappers.RSObject;
    import com.speljohan.rsbot.script.wrappers.RSTile;
    
    public class AlKharidSmelter extends Script implements PaintListener,
            ServerMessageListener {
    
        private JFrame frame;
        private final int bank_Windows = 35647, coal = 453, furnaceO = 11669,
                ring_ID = 2568;
        private final long startTime = System.currentTimeMillis();
        private RSTile furnace_Tile = new RSTile(3273, 3186);
        private final int to_Bank = 1, banking = 2, to_Furnace = 3, smelting = 4,
                counting = 5, done = 6, stop = 7;
        private int state = 0, tries = 0, ore1 = 0, ore2 = 0, ore_Amount,
                ore_Type = 0, count = 0, ore1_Note, ore2_Note, smelted = 0,
                need1_Amount, need2_Amount;
        private String ore1_Name, ore2_Name, doing = "Nothing";
        private boolean need_Ore1 = false, need_Ore2 = false, need_Smelt = false,
                need_Bank = false, at_Bank = false, at_Furnace = false,
                get_Count = false, use_Ring = false, need_Ring = false,
                first_Run = true, wait_Done = false, wait_Stopped = false,
                on_Tab = false, use_Search = false;
        private final RSTile[] path = new RSTile[] { new RSTile(3270, 3173),
                new RSTile(3275, 3186) };
        private Point bank_Ore1, bank_Ore2, first_Tab = new Point(50, 60);
        private int bank_Tab = 0;
    
        public String getName() {
            return "Al Kharid Smelter";
        }
    
        public String getAuthor() {
            return "Fusion89k";
        }
    
        public double getVersion() {
            return 2.2;
        }
    
        public String getScriptCategory() {
            return "Smelting";
        }
    
        public String getScriptDescription() {
            Object o = parameters.get("description");
            return o instanceof String ? (String) o
                    : "<html>"
                            + "<head></head>"
                            + "<body>"
                            + "<table style=\"text-align: left; width: 100%; height: 10px;\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">"
                            + "<tr>"
                            + "<td style=\"background-color: rgb(78, 150, 138);\" align=\"center\"><h2>"
                            + getName()
                            + "</h2></td>"
                            + "</tr>"
                            + "<tr>"
                            + "<td style=\"background-color: rgb(95, 181, 167);\"><b>Autor</b> "
                            + getAuthor()
                            + "<br /><b>Version:</b> "
                            + getVersion()
                            + "<br /><b>Aruments by:</b> Bite</b></td>"
                            + "</tr>"
                            + "<tr>"
                            + "<td style=\"background-color: rgb(78, 150, 138);\" align=\"center\"><h3>Options</h3></td>"
                            + "</tr>"
                            + "<tr>"
                            + "<td style=\"background-color: rgb(95, 181, 167);\">"
                            + "<form>Bar Type:"
                            + "<select name=\"type\">"
                            + "<option name=\"type\" value=\"Bronze\">Bronze</option>"
                            + "<option name=\"type\" value=\"Iron\">Iron</option>"
                            + "<option name=\"type\" value=\"Steel\">Silver</option>"
                            + "<option name=\"type\" value=\"Silver\">Steel</option>"
                            + "<option name=\"type\" value=\"Gold\">Gold</option>"
                            + "<option name=\"type\" value=\"\" mithril=\"\">Mithril</option>"
                            + "<option name=\"type\" value=\"\" adamant=\"\">Adamant</option>"
                            + "<option name=\"type\" value=\"\" rune=\"\">Rune</option>"
                            + "</select>"
                            + "<br />"
                            + "Auto Count:<input name=\"auto\" value=\"1\" checked=\"checked\" type=\"checkbox\"><br />"
                            + "Ring of Forging:<input name=\"ring\" value=\"1\" type=\"checkbox\">"
                            + "<br/>Search:<input name\"search\" value=\"1\" type=\"checkbox\">"
                            + "</form>"
                            + "</td>"
                            + "</tr>"
                            + "<tr>"
                            + "<td style=\"background-color: rgb(78, 150, 138);\" align=\"center\"><h3>Features</h3></td>"
                            + "</tr>"
                            + "<tr>"
                            + "<td style=\"background-color: rgb(95, 181, 167);\">"
                            + "*Can Smelt Any bar<br />"
                            + "* AWEOME BANKING<br />"
                            + "* Auto Counter or Manual Count<br />"
                            + "* Ring of Forging Supported<br />"
                            + "* Pretty Paint<br />"
                            + "</td>"
                            + "</tr>"
                            + "</tbody>"
                            + "</table>"
                            + "<br />"
                            + "</body>"
                            + "</html>";
        }
    
        public boolean onStart(Map<String, String> args) {
            int tip = 0;
            if (args.get("type").equals("Bronze"))
                tip = 1;
            else if (args.get("type").equals("Iron"))
                tip = 2;
            else if (args.get("type").equals("Silver"))
                tip = 3;
            else if (args.get("type").equals("Steel"))
                tip = 4;
            else if (args.get("type").equals("Gold"))
                tip = 5;
            else if (args.get("type").equals("Mithril"))
                tip = 6;
            else if (args.get("type").equals("Adamant"))
                tip = 7;
            else if (args.get("type").equals("Rune"))
                tip = 8;
            ore_Type = tip;
            switch (tip) {
            case 1:
                ore_Amount = 14;
                ore1 = 436;
                ore2 = 438;
                ore1_Name = "Copper";
                ore2_Name = "Tin";
                ore1_Note = 437;
                ore2_Note = 439;
                break;
            case 2:
                ore_Amount = 28;
                ore1 = 440;
                ore1_Name = "Iron";
                ore1_Note = 441;
                break;
            case 3:
                ore_Amount = 28;
                ore1 = 442;
                ore1_Name = "Silver";
                ore1_Note = 443;
                break;
            case 4:
                ore_Amount = 9;
                ore1 = 440;
                ore2 = coal;
                ore1_Name = "Iron";
                ore2_Name = "Coal";
                ore1_Note = 441;
                ore2_Note = 454;
                break;
            case 5:
                ore_Amount = 28;
                ore1 = 444;
                ore1_Name = "Gold";
                ore1_Note = 445;
                ore2_Note = 454;
                break;
            case 6:
                ore_Amount = 5;
                ore1 = 447;
                ore2 = coal;
                ore1_Name = "Mithril";
                ore2_Name = "Coal";
                ore1_Note = 448;
                ore2_Note = 454;
    
                break;
            case 7:
                ore_Amount = 4;
                ore1 = 449;
                ore2 = coal;
                ore1_Name = "Adamantite";
                ore2_Name = "Coal";
                ore1_Note = 450;
                ore2_Note = 454;
                break;
            case 8:
                ore_Amount = 3;
                ore1 = 451;
                ore2 = coal;
                ore1_Name = "Runite";
                ore2_Name = "Coal";
                ore1_Note = 452;
                ore2_Note = 454;
                break;
    
            }
            if (args.get("auto") == null) {
                showBox();
                pause();
                while (frame.isVisible()) {
                    pause();
                }
            } else
                get_Count = true;
            if (args.get("ring") != null) {
                use_Ring = true;
            }
            if (args.get("search") == null)
                use_Search = false;
            else
                use_Search = true;
            setCameraAltitude(true);
            setCompass('n');
            Bot.getEventManager().addListener(PaintListener.class, this);
            return true;
        }
    
        public void onFinish() {
            Bot.getEventManager().removeListener(PaintListener.class, this);
        }
    
        public int loop() {
            locate();
            tries = 0;
            if (first_Run && !get_Count && !need_Smelt) {
                if (!RSInterface.getInterface(INTERFACE_BANK).isValid()) {
                    RSObject booth = findObject(bank_Windows);
                    if (distanceTo(booth) >= 5) {
                        walk(path, false);
                        wait_Stopped = true;
                        return random(700, 900);
                    }
                    atObject(booth, "Use-quickly");
                }
                if (RSInterface.getInterface(INTERFACE_BANK).isValid()) {
                    bank.depositAll();
                    if (bank_Tab == 0) {
                        tabCheck(ore1_Name);
                        if (!on_Tab) {
                            moveOre(ore1);
                        }
                    } else {
                        if (!on_Tab) {
                            clickMouse(bankClick(bank_Tab), true);
                            on_Tab = true;
                        }
                    }
                    if (ore2_Name != null) {
                        if (!on_Tab) {
                            clickMouse(bankClick(bank_Tab), true);
                        }
                        if (!oreCheck(ore2)) {
                            clickMouse(first_Tab, true);
                            smallWait();
                            moveOre(ore2);
                            pause();
                        }
                    }
                    if (use_Ring) {
                        if (!on_Tab) {
                            clickMouse(bankClick(bank_Tab), true);
                        }
                        int temp = ring_ID;
                        if (ore2_Name == null)
                            temp = ore2;
                        if (!oreCheck(temp)) {
                            clickMouse(first_Tab, true);
                            smallWait();
                            moveOre(ring_ID);
                            pause();
                        }
                    }
                }
                first_Run = false;
            }
            if (wait_Done)
                state = done;
            if (wait_Stopped)
                state = stop;
            if (get_Count && !need_Smelt)
                state = counting;
            switch (state) {
            case to_Bank:
                walk(path, false);
                return locate();
            case banking:
                doing = "Banking";
                if (need_Ring)
                    return withdraw(ring_ID, "Ring of Forging");
                if (inventoryContains(ring_ID)) {
                    bank.close();
                    atInventoryItem(ring_ID, "wear");
                    smallWait();
                }
                need1_Amount = ore_Amount - getInventoryCount(ore1);
                if (need_Ore1)
                    return withdraw(ore1, ore1_Name);
                if (getInventoryCount(ore1) < ore_Amount && bank_Ore2 != null)
                    bank_Ore2 = bank_Ore1;
                if (need_Ore2) {
                    int temp = getInventoryCount(ore2);
                    switch (ore_Type) {
                    case 1:
                        need2_Amount = ore_Amount - temp;
                        break;
                    case 4:
                        need2_Amount = ore_Amount * 2 - temp;
                        break;
                    case 6:
                        need2_Amount = ore_Amount * 4 - temp;
                        break;
                    case 7:
                        need2_Amount = ore_Amount * 6 - temp;
                        break;
                    case 8:
                        need2_Amount = ore_Amount * 8 - temp;
                        break;
                    }
                    return withdraw(ore2, ore2_Name);
                }
                return locate();
            case to_Furnace:
                walk(path, true);
                return locate();
            case smelting:
                doing = "Finding Furnace";
                RSObject fur = getObjectAt(furnace_Tile);
                if (distanceTo(fur) >= 5) {
                    walkTileMM(fur.getLocation());
                    wait_Stopped = true;
                    return locate();
                } else {
                    doing = "Smelting";
                    openTab(TAB_INVENTORY);
                    if (getMyPlayer().getAnimation() != -1){
                        wait_Done = true;
                        return locate();
                    }
                    RSTile tempT = new RSTile(fur.getLocation().getX(), fur
                            .getLocation().getY());
                    atTile(tempT, "Smelt");
                    pause();
                    if (RSInterface.getInterface(INTERFACE_SMELTINGSCREEN)
                            .isValid()) {
                        int minX = 28, maxX = 78;
                        int minY = 390, maxY = 457;
                        switch (ore_Type) {
                        case 1:// Bronze
                            clickMouse(new Point(random(minX, maxX), random(minY,
                                    maxY)), false);
                            break;
                        case 2:// Iron
                            minX = 130;
                            maxX = 178;
                            clickMouse(new Point(random(minX, maxX), random(minY,
                                    maxY)), false);
                            break;
                        case 3:// Silver
                            minX = 182;
                            maxX = 229;
                            clickMouse(new Point(random(minX, maxX), random(minY,
                                    maxY)), false);
                            break;
                        case 4:// Steel
                            minX = 234;
                            maxX = 279;
                            clickMouse(new Point(random(minX, maxX), random(minY,
                                    maxY)), false);
                            break;
                        case 5:// Gold
                            minX = 286;
                            maxX = 333;
                            clickMouse(new Point(random(minX, maxX), random(minY,
                                    maxY)), false);
                            break;
                        case 6:// Mithril
                            minX = 338;
                            maxX = 387;
                            clickMouse(new Point(random(minX, maxX), random(minY,
                                    maxY)), false);
                            break;
                        case 7:// Adamant
                            minX = 390;
                            maxX = 441;
                            clickMouse(new Point(random(minX, maxX), random(minY,
                                    maxY)), false);
                            break;
                        case 8:// Rune
                            minX = 442;
                            maxX = 496;
                            clickMouse(new Point(random(minX, maxX), random(minY,
                                    maxY)), false);
                            break;
                        }
                        doing = "Smelting";
                        int temp = random(getInventoryCount(ore1), getInventoryCount(ore1)+5);
                        switch (temp) {
                        case 1:
                            atMenu("1");
                            break;
                        case 5:
                            atMenu("5");
                            break;
                        case 10:
                            atMenu("10");
                            break;
                        default:
                            atMenu("Smelt x");
                            pause();
                            pause();
                            if (checkX()) {
                                sendText("" + temp, true);
                            }
                        }
                        pause();
                        wait_Done = true;
                        return locate();
                    } else
                        return locate();
                }
            case counting:
                locate();
                if (at_Bank) {
                    if (!RSInterface.getInterface(Constants.INTERFACE_BANK)
                            .isValid()) {
                        RSObject booth = findObject(bank_Windows);
                        if (booth == null) {
                            log("Counting Error");
                            walk(path, false);
                        }
                        atObject(booth, "Use-quickly");
                    }
                    if (RSInterface.getInterface(Constants.INTERFACE_BANK)
                            .isValid()) {
                        bank.depositAll();
                        if (use_Search) {
                            bank.searchItem(ore1_Name);
                            while (!inventoryContains(ore1_Note)) {
                                clickMouse(oreClick(ore1), false);
                                smallWait();
                                atMenu("All");
                            }
                            bank.searchItem("");
                            String name = ore2_Name;
                            if (ore_Type == 1)
                                name = ore2_Name + " ore";
                            bank.searchItem(name);
                            while (!inventoryContains(ore2_Note)) {
                                clickMouse(oreClick(ore1), false);
                                smallWait();
                                atMenu("All");
                            }
                            bank.searchItem("");
                            int temp1 = getInventoryCount(ore1_Note);
                            int temp2 = 0;
                            if (ore2_Name != null)
                                temp2 = getInventoryCount(ore2_Note);
                            switch (ore_Type) {
                            case 1:
                                if (temp1 < temp2)
                                    count = temp1;
                                else
                                    count = temp2;
                                break;
                            case 2:
                            case 3:
                            case 5:
                                count = temp1;
                                break;
                            case 4:
                                if (temp1 * 2 < temp2)
                                    count = temp1;
                                else
                                    count = temp2 / 2;
                                break;
                            case 6:
                                if (temp1 * 4 < temp2)
                                    count = temp1;
                                else
                                    count = temp2 / 4;
                                break;
                            case 7:
                                if (temp1 * 6 < temp2)
                                    count = temp1;
                                else
                                    count = temp2 / 6;
                                break;
                            case 8:
                                if (temp1 * 8 < temp2)
                                    count = temp1;
                                else
                                    count = temp2 / 8;
                                break;
                            }
                            if (count <= 0)
                                return locate();
                            bank.depositAll();
                        }
    
                        if (bank_Tab == 0) {
                            tabCheck(ore1_Name);
                            if (!on_Tab) {
                                moveOre(ore1);
                            }
                        } else {
                            if (!on_Tab) {
                                clickMouse(bankClick(bank_Tab), true);
                                on_Tab = true;
                            }
                        }
                        note(true);
                        clickMouse(oreClick(ore1), false);
                        smallWait();
                        atMenu("All but");
                        pause();
                        while (!inventoryContains(ore1_Note)) {
                            clickMouse(oreClick(ore1), false);
                            atMenu("All but");
                            pause();
                        }
                        if (ore2_Name != null) {
                            if (on_Tab) {
                                if (!oreCheck(ore2)) {
                                    clickMouse(first_Tab, true);
                                    smallWait();
                                    moveOre(ore2);
                                    pause();
                                }
                                clickMouse(oreClick(ore2), false);
                                atMenu("All but");
                                pause();
                                while (!inventoryContains(ore2_Note)) {
                                    clickMouse(oreClick(ore2), false);
                                    atMenu("All but");
                                    pause();
                                }
                            } else {
                                clickMouse(bankClick(bank_Tab), true);
                                if (!oreCheck(ore2)) {
                                    clickMouse(first_Tab, true);
                                    smallWait();
                                    moveOre(ore2);
                                    pause();
                                }
                                clickMouse(oreClick(ore2), false);
                                atMenu("All but");
                                pause();
                                while (!inventoryContains(ore2_Note)) {
                                    clickMouse(oreClick(ore2), false);
                                    atMenu("All but");
                                    pause();
                                }
                            }
                        }
                        note(false);
                    }
                    if (use_Ring) {
                        if (!on_Tab)
                            clickMouse(bankClick(bank_Tab), true);
                        int temp = ring_ID;
                        if (ore2_Name == null)
                            temp = ore2;
                        if (!oreCheck(temp)) {
                            clickMouse(first_Tab, true);
                            smallWait();
                            moveOre(ring_ID);
                            pause();
                        }
                    }
                    int temp1 = getInventoryCount(ore1_Note) + 1;
                    int temp2 = 0;
                    if (ore2_Name != null)
                        temp2 = getInventoryCount(ore2_Note) + 1;
                    switch (ore_Type) {
                    case 1:
                        if (temp1 < temp2)
                            count = temp1;
                        else
                            count = temp2;
                        break;
                    case 2:
                    case 3:
                    case 5:
                        count = temp1;
                        break;
                    case 4:
                        if (temp1 * 2 < temp2)
                            count = temp1;
                        else
                            count = temp2 / 2;
                        break;
                    case 6:
                        if (temp1 * 4 < temp2)
                            count = temp1;
                        else
                            count = temp2 / 4;
                        break;
                    case 7:
                        if (temp1 * 6 < temp2)
                            count = temp1;
                        else
                            count = temp2 / 6;
                        break;
                    case 8:
                        if (temp1 * 8 < temp2)
                            count = temp1;
                        else
                            count = temp2 / 8;
                        break;
                    }
                    if (count <= 0)
                        return locate();
                    bank.depositAll();
                    get_Count = false;
                    first_Run = false;
                    return locate();
                } else {
                    walk(path, false);
                    return locate();
                }
            case done:
                pause();
                if (getMyPlayer().getAnimation() == -1) {
                    pause();
                    locate();
                    if (getMyPlayer().getAnimation() == -1)
                        wait_Done = false;
                }
                if (random(1, 7) == 3)
                    antiBan();
                return random(700, 900);
            case stop:
                if (!getMyPlayer().isMoving())
                    wait_Stopped = false;
                return random(700, 900);
            default:
                return locate();
            }
        }
    
        private int locate() {
            if (getInventoryCount(ore1) < 1)
                need_Ore1 = true;
            else
                need_Ore1 = false;
            if (use_Ring && !inventoryContains(ring_ID))
                need_Ring = true;
            switch (ore_Type) {
            case 1:
                if (getInventoryCount(ore2) < 1)
                    need_Ore2 = true;
                else
                    need_Ore2 = false;
                break;
            case 4:
                if (getInventoryCount(ore2) / 2 < getInventoryCount(ore1))
                    need_Ore2 = true;
                else
                    need_Ore2 = false;
                break;
            case 6:
                if (getInventoryCount(ore2) / 4 < getInventoryCount(ore1))
                    need_Ore2 = true;
                else
                    need_Ore2 = false;
                break;
            case 7:
                if (getInventoryCount(ore2) / 6 < getInventoryCount(ore1))
                    need_Ore2 = true;
                else
                    need_Ore2 = false;
                break;
            case 8:
                if (getInventoryCount(ore2) / 8 < getInventoryCount(ore1))
                    need_Ore2 = true;
                else
                    need_Ore2 = false;
                break;
            }
            if (need_Ore1 || need_Ore2) {
                need_Bank = true;
                need_Smelt = false;
            } else {
                need_Bank = false;
                need_Smelt = true;
            }
            if (distanceTo(findObject(bank_Windows)) <= 8) {
                at_Bank = true;
                at_Furnace = false;
            } else if (distanceTo(findObject(furnaceO)) <= 8) {
                at_Bank = false;
                at_Furnace = true;
            } else {
                at_Bank = false;
                at_Furnace = false;
            }
    
            if ((count <= 0 && !get_Count) && !need_Smelt) {
                log("Out of Ore");
                stopAllScripts();
                return -1;
            } else if (get_Count && count > 0)
                get_Count = false;
    
            if (get_Count)
                state = counting;
            else if (need_Bank && at_Bank)
                state = banking;
            else if (need_Bank && !at_Bank)
                state = to_Bank;
            else if (need_Smelt && at_Furnace)
                state = smelting;
            else if (need_Smelt && !at_Furnace)
                state = to_Furnace;
            else
                state = 0;
            return 100;
        }
    
        private int withdraw(int id, String name) {
            doing = "Withdrawing " + name;
            tries++;
            if (tries > 5) {
                log("Bank Error");
                return -1;
            }
            if (!RSInterface.getInterface(Constants.INTERFACE_BANK).isValid()) {
                RSObject booth = findObject(bank_Windows);
                if (booth == null) {
                    walk(path, false);
                    pause();
                    waitTilStopped();
                    withdraw(id, name);
                } else if (distanceTo(booth) >= 5) {
                    walkTileMM(booth.getLocation());
                    pause();
                    waitTilStopped();
                    withdraw(id, name);
                } else
                    atObject(booth, "Use-quickly");
            }
            if (RSInterface.getInterface(Constants.INTERFACE_BANK).isValid()) {
                String temp = doing;
                doing = "Depositing Items";
                bank.depositAllExcept(ore1, ore2, ring_ID);
                if (getInventoryCount(ore1) > ore_Amount) {
                    depositX(ore1, getInventoryCount(ore1) - ore_Amount);
                }
                if (!oreCheck(ore2) && !use_Search) {
                    clickMouse(bankClick(bank_Tab), true);
                }
                note(false);
                Point click;
                int need;
                if (id == ore1)
                    need = need1_Amount;
                else if (id == ore2)
                    need = need2_Amount;
                else
                    need = 1;
                if (!use_Search) {
                    if (id == ore1)
                        click = oreClick(ore1);
                    else if (id == ore2)
                        click = oreClick(ore2);
                    else {
                        if (ore2_Name == null)
                            click = oreClick(ore2);
                        else
                            click = oreClick(ring_ID);
                    }
                } else {
                    bank.searchItem(name);
                    click = oreClick(ore1);
                }
                tries = 0;
                while (getInventoryCount(id) < need) {
                    doing = temp;
                    if (tries > 6) {
                        log("Withdrawing " + name + " Error");
                        stopAllScripts();
                    }
                    clickMouse(click, false);
                    if (id == ore2) {
                        switch (need2_Amount) {
                        case 1:
                            atMenu("1");
                            break;
                        case 5:
                            atMenu("5");
                        case 10:
                            atMenu("10");
                            break;
                        default:
                            atMenu("All");
                        }
                        pause();
                    } else if (name.contains("of")) {
                        atMenu("1");
                        pause();
                    } else {
                        if (ore_Amount >= 28 && getMenuIndex("28") == -1
                                && need1_Amount >= 28)
                            atMenu("All");
                        else if (ore_Amount >= 28 && need1_Amount >= 28)
                            atMenu("28");
                        else {
                            switch (need1_Amount) {
                            case 1:
                                atMenu("1");
                                break;
                            case 5:
                                atMenu("5");
                                break;
                            case 10:
                                atMenu("10");
                                break;
                            default:
                                if (getMenuIndex("" + ore_Amount) == -1) {
                                    atMenu("x");
                                    pause();
                                    pause();
                                    if (checkX()) {
                                        if (count < ore_Amount)
                                            ore_Amount = count;
                                        sendText("" + ore_Amount, true);
                                        pause();
                                    }
                                } else
                                    atMenu("" + ore_Amount);
                                break;
                            }
                        }
                    }
                    pause();
                    tries++;
                }
            } else {
                if (use_Search)
                    bank.searchItem("");
                withdraw(id, name);
            }
            if (use_Search)
                bank.searchItem("");
            return locate();
        }
    
        private void depositX(int ore, int diff) {
            while (true) {
                atInventoryItem(ore, "x");
                pause();
                if (checkX()) {
                    sendText("" + diff, true);
                    pause();
                    break;
                }
            }
        }
    
        private void walk(RSTile[] path, boolean toEnd) {
            locate();
            String run;
            if (toEnd && at_Furnace)
                return;
            if (!toEnd && at_Bank)
                return;
            if (RSInterface.getInterface(INTERFACE_BANK).isValid())
                bank.close();
            int index = 0;
            for (int I = 1; I < path.length; I++) {
                if (distanceTo(path[I]) < distanceTo(path[index]))
                    index = I;
            }
            if (toEnd) {
                openTab(TAB_INVENTORY);
                for (int I = index; I < path.length; I++) {
                    checkRun();
                    if (isRunning())
                        run = "Running";
                    else
                        run = "Walking";
                    doing = run + " to Furnace";
                    RSTile start = getMyPlayer().getLocation();
                    RSTile click = new RSTile(path[I].getX() + random(-2, 2),
                            path[I].getY() + random(-2, 2));
                    if (I == path.length - 1)
                        while (!checkClick(click)) {
                            click = new RSTile(path[I].getX() + random(-2, 2),
                                    path[I].getY() + random(-2, 2));
                        }
                    walkTileMM(click);
                    pause();
                    waitTilThere(click, start);
                }
                if (distanceTo(path[path.length - 1]) >= 5) {
                    walk(path, toEnd);
                }
            } else {
                for (int I = index; I > -1; I--) {
                    checkRun();
                    if (isRunning())
                        run = "Running";
                    else
                        run = "Walking";
                    doing = run + " to Bank";
                    RSTile start = getMyPlayer().getLocation();
                    RSTile click = new RSTile(path[I].getX() + random(-2, 2),
                            path[I].getY() + random(-2, 2));
                    walkTileMM(click);
                    pause();
                    waitTilThere(click, start);
                }
                if (distanceTo(path[0]) >= 5) {
                    walk(path, toEnd);
                }
            }
        }
    
        private void pause() {
            wait(random(900, 1100));
        }
    
        private void smallWait() {
            wait(random(100, 150));
        }
    
        private void checkRun() {
            if (RSInterface.getInterface(Constants.INTERFACE_BANK).isValid())
                return;
            if (isRunning())
                return;
            if (getEnergy() < 40)
                return;
            setRun(true);
            openTab(TAB_INVENTORY);
        }
    
        private boolean isNote() {
            int temp = RSInterface.getChildInterface(762, 16).getBackgroundColor();
            if (temp != 1431)
                return true;
            else
                return false;
        }
    
        private void note(boolean what) {
            if (what) {
                while (!isNote()) {
                    clickMouse(random(225, 259), random(291, 325), true);
                    pause();
                }
            } else {
                while (isNote()) {
                    clickMouse(random(225, 259), random(291, 325), true);
                    pause();
                }
            }
    
        }
    
        private void waitTilThere(RSTile there, RSTile start) {
            while (true) {
                if (distanceTo(there) <= 4)
                    waitTilStopped();
                pause();
                if (!getMyPlayer().isMoving()) {
                    if (distanceTo(start) <= 4 || distanceTo(there) <= 4)
                        break;
                }
    
            }
        }
    
        private void waitTilStopped() {
            while (true) {
                if (!getMyPlayer().isMoving())
                    break;
                pause();
            }
    
        }
    
        private boolean checkX() {
            if (RSInterface.getChildInterface(752, 4).isValid())
                return true;
            return false;
        }
    
        private boolean checkClick(RSTile click) {
            int x = click.getX(), y = click.getY();
            if (x > 3279 || x < 3272) {
                return false;
            }
            if (y > 3189 || y < 3183) {
                return false;
            }
            return true;
        }
    
        private void antiBan() {
            int which = random(1, 3);
            switch (which) {
            case 1:
                moveMouse(random(0, 515), random(0, 330));
                break;
            case 2:
                openTab(random(0, 14));
                break;
            case 3:
                openTab(TAB_STATS);
                moveMouse(random(564, 721), random(216, 454));
                break;
            }
        }
    
        private Point bankCheck(String name) {
            return bankCheck(name, new Point(50, 100));
        }
    
        private Point bankCheck(String name, Point start) {
            String temp = doing;
            Point tempo = null;
            doing = "Bank Check";
            int x = (int) start.getX(), y = (int) start.getY();
            if (!RSInterface.getInterface(Constants.INTERFACE_BANK).isValid()) {
                RSObject booth = findObject(bank_Windows);
                if (booth == null) {
                    walk(path, false);
                    pause();
                    waitTilStopped();
                    return bankCheck(name);
                } else if (distanceTo(booth) > 5) {
                    walk(path, false);
                    pause();
                    waitTilStopped();
                    return bankCheck(name);
                } else
                    atObject(booth, "Use-quickly");
            }
            tries = 0;
            if (RSInterface.getInterface(Constants.INTERFACE_BANK).isValid()) {
                doing = "Looking for " + name;
                moveMouse(x, y);
                ArrayList<String> array = getMenuOptions();
                while (array.get(0).equals("")) {
                    array = getMenuOptions();
                }
                while (!array.get(0).contains(name)) {
                    if (tries >= 100) {
                        log("Tries:" + tries);
                        array = getMenuActions();
                        if (!array.get(0).toLowerCase().contains("raw")) {
                            log(array.get(0));
                            log(array.get(0).toLowerCase().contains("raw") + "");
                            log("Bank Check Error");
                            bank.close();
                            pause();
                            stopAllScripts();
                        } else {
                            tries = 0;
                            array = getMenuOptions();
                        }
                    }
                    x += 45;
                    if (x >= 460) {
                        if (y < 480) {
                            y += 42;
                            x = 50;
                        }
                    }
                    moveMouse(x, y);
                    smallWait();
                    array = getMenuOptions();
                    if (array.size() > 0 && array.get(0).equals("")) {
                        tries++;
                        x -= 45;
                    } else {
                        tries = 0;
                    }
                }
                doing = "Found " + name;
                tempo = new Point(x, y);
            }
            pause();
            doing = temp;
            first_Run = false;
            return tempo;
        }
    
        private void tabCheck(String name) {
            if (!RSInterface.getInterface(Constants.INTERFACE_BANK).isValid()) {
                RSObject booth = findObject(bank_Windows);
                if (booth == null) {
                    walk(path, false);
                    pause();
                    waitTilStopped();
                    tabCheck(name);
                } else if (distanceTo(booth) > 5) {
                    walk(path, false);
                    pause();
                    waitTilStopped();
                    tabCheck(name);
                } else {
                    atObject(booth, "Use-quickly");
                }
    
            }
            if (RSInterface.getInterface(Constants.INTERFACE_BANK).isValid()) {
                showGameChatMessages();
                int y = 60, x;
                for (x = 0; x < 50 * 8; x += 50) {
                    clickMouse(x+90, y, true);
                    pause();
                    for (int I = 64; I < 157; I++) {
                        if (RSInterface.getChildInterface(137, I).getText()
                                .contains("new tab")) {
                            bank_Tab = ((x-90)/50)+3;
                            log(bank_Tab+"");
                            break;
                        }
                    }
                    if (bank_Tab == 0) {
                        moveMouse(random(38, 73), random(92, 123));
                        smallWait();
                        while (getMenuOptions().get(0).equals(""))
                            smallWait();
                        if (getMenuOptions().get(0).contains(name)) {
                            bank_Tab = ((x-90)/50)+3;
                            on_Tab = true;
                            break;
                        }
                    } else
                        break;
                }
                if (!on_Tab) {
                    clickMouse(first_Tab, true);
                }
            }
            showAllChatMessages();
        }
    
        private Point bankClick(int index) {
            int y = random(37, 84);
            switch (index) {
            case 2:
                return new Point(random(73, 120), y);
            case 3:
                return new Point(random(121, 168), y);
            case 4:
                return new Point(random(169, 216), y);
            case 5:
                return new Point(random(217, 264), y);
            case 6:
                return new Point(random(265,312),y);
            case 7:
                return new Point(random(313,360),y);
            case 8:
                return new Point(random(361,408),y);
            case 9:
                return new Point(random(409,456),y);
            default:
                return new Point(random(25,72),y);
            }
        }
    
        private Point oreClick(int id) {
            if (id == ore1)
                return new Point(random(38, 73), random(92, 123));
            else if (id == ore2)
                return new Point(random(82, 117), random(92, 123));
            else
                return new Point(random(126, 161), random(92, 123));
        }
    
        private boolean oreCheck(int id) {
            if (ore2_Name == null && id != ring_ID)
                return false;
            Point temp;
            if (id == ore2)
                temp = oreClick(ore2);
            else
                temp = oreClick(ring_ID);
            moveMouse(temp);
            long start = System.currentTimeMillis();
            while (getMenuOptions().get(0).equals("")) {
                if (System.currentTimeMillis() - start > 3000)
                    break;
                smallWait();
            }
            if (getMenuOptions().get(0).contains(ore2_Name) && id != ring_ID)
                return true;
            else if (getMenuOptions().get(0).contains("of") && id == ring_ID)
                return true;
            return false;
        }
    
        private void moveOre(int id) {
            Point temp;
            if (id == ore1)
                temp = bankCheck(ore1_Name);
            else if (id == ore2) {
                if (ore_Type == 1)
                    temp = bankCheck(ore2_Name + " ore");
                else
                    temp = bankCheck(ore2_Name);
            } else
                temp = bankCheck("Ring of Forging");
            pressMouse(temp.x, temp.y, true);
            moveMouse(bankClick(bank_Tab));
            releaseMouse(bankClick(bank_Tab).x, bankClick(bank_Tab).y, true);
            pause();
            clickMouse(bankClick(bank_Tab), true);
            on_Tab = true;
        }
    
        private void showBox() {
            frame = new JFrame("Manual Counter");
            frame.setLayout(new FlowLayout());
            frame.add(new JLabel(ore1_Name + ": "));
            final JTextField txt = new JTextField("0", 4);
            frame.add(txt, 1);
            JButton but = new JButton("Start");
            but.setFocusable(true);
            frame.add(but, 2);
            but.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent evt) {
                    count = Integer.parseInt(txt.getText());
                    frame.setVisible(false);
                }
            });
            frame.setSize(200, 85);
            frame.setVisible(true);
        }
    
        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;
                String temp = ore1_Name;
                if (temp.equals("Copper"))
                    temp = "Bronze";
                int topX = 515 - 173, topY = 337 - 80, x = topX + 5, y = topY + 5;
                g.setColor(new Color(0, 100, 0, 100));
                g.fill3DRect(topX, topY, 515 - topX, 337 - topY, true);
                g.setColor(Color.green);
                g.drawString("Runtime: " + hours + "h " + minutes + "min "
                        + seconds + "sec.", x, y += 15);
                g.drawString("Ore Left: " + Integer.toString(count), x, y += 15);
                g.drawString("Bars: " + Integer.toString(smelted) + " " + temp
                        + " Bars.", x, y += 15);
                g.drawString("Status: " + doing, x, y += 15);
            }
        }
    
        @Override
        public void serverMessageRecieved(ServerMessageEvent e) {
            String word = e.getMessage().toLowerCase();
            if (word.contains("retrieve")) {
                smelted++;
                count--;
            } else if (word.contains("fail"))
                count--;
        }
    
        private byte dragLength = 0;
    
        private void pressMouse(int x, int y, boolean left) {
            MouseEvent me = new MouseEvent((Applet) Bot.getClient(),
                    MouseEvent.MOUSE_PRESSED, System.currentTimeMillis(), 0, x, y,
                    1, false, left ? MouseEvent.BUTTON1 : MouseEvent.BUTTON3);
            Bot.getClient().getMouse()._mousePressed(me);
        }
    
        private void releaseMouse(int x, int y, boolean leftClick) {
            MouseEvent me = new MouseEvent((Applet) Bot.getClient(),
                    MouseEvent.MOUSE_RELEASED, System.currentTimeMillis(), 0, x, y,
                    1, false, leftClick ? MouseEvent.BUTTON1 : MouseEvent.BUTTON3);
            Bot.getClient().getMouse()._mouseReleased(me);
    
            if ((dragLength & 0xFF) <= 3) {
                me = new MouseEvent((Applet) Bot.getClient(),
                        MouseEvent.MOUSE_CLICKED, System.currentTimeMillis(), 0, x,
                        y, 1, false, leftClick ? MouseEvent.BUTTON1
                                : MouseEvent.BUTTON3);
                Bot.getClient().getMouse()._mouseClicked(me);
            }
            // reset
            dragLength = 0;
        }
    }
    
     
  11. Unread #6 - Jan 5, 2009 at 3:28 AM
  12. Fusion009
    Joined:
    Dec 6, 2005
    Posts:
    12
    Referrals:
    0
    Sythe Gold:
    0

    Fusion009 Newcomer

    All Smelter Script?

    The problem is that coal should be in the second slot and mith should be in the first. Stick with the All Smelter since it is better than the Al Kharid Smelter
     
< [Borrowing]Any Party Hat[Borrowing] | lvl 57 range/2h/mauler >

Users viewing this thread
1 guest
Thread Status:
Not open for further replies.


 
 
Adblock breaks this site