Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • Try asking for help in the chatbox
  • Camelot (Rimmington) Teletabs!


    jmarsiglio2
     Share

    Recommended Posts

    Hey, I made a VERY specific script for myself to make Camelot tele tabs.

     

    It's rudimentary so far but if people use it I can flesh it out.

     

    - You will need to modify the hostName variable with the name of whoever is hosting the house

    - Your house needs to be in Rimmington

    - You need to start in the host house

    - You will need an air staff equipped and law runes in your inventory

    - You will need VARROCK and HOUSE TELEPORT TABS in your inventory (to teleport back and forth)

     

    If people use this I can make it so this can be configured at runtime and support other teleport methods. Cheers

     

    MainClass.java

    package MageTabs;
    
    import org.dreambot.api.methods.Calculations;
    import org.dreambot.api.methods.map.Area;
    import org.dreambot.api.methods.map.Tile;
    import org.dreambot.api.methods.skills.Skill;
    import org.dreambot.api.methods.widget.Widget;
    import org.dreambot.api.script.AbstractScript;
    import org.dreambot.api.script.Category;
    import org.dreambot.api.script.ScriptManifest;
    import org.dreambot.api.utilities.InventoryMonitor;
    import org.dreambot.api.utilities.Timer;
    import org.dreambot.api.wrappers.interactive.GameObject;
    import org.dreambot.api.wrappers.interactive.NPC;
    import org.dreambot.api.wrappers.items.Item;
    import org.dreambot.api.wrappers.widgets.WidgetChild;
    
    import java.awt.*;
    import java.util.HashMap;
    
    @ScriptManifest(category = Category.MAGIC, name = "Mage tabs", author = "JM", version = 1.0)
    public class MainClass extends AbstractScript {
    
        private Area rimmingtonPortal = new Area(2950, 3227, 2955, 3222, 0);
        private Area varrockSquare = new Area(3208, 3426, 3219, 3422, 0);
        private Area varrockBank = new Area(3179, 3432, 3191, 3450, 0);
        private Area outsideVarrockBank = new Area(3184, 3434, 3180, 3436, 0);
        private Tile lecternTile; // learns the tile of the lectern
    
        private String bankKeep[] = {"Varrock teleport", "Teleport to house", "Air rune", "Law rune", "Fire rune"};
        private String state = "null";
        private String hostName = "name_of_host";
        private HashMap<String, Integer> widgetIDs = new HashMap<>();
        private String tabType = "Camelot";
        private final int TAB_WIDGET_ID = 79;
    
        private int tabCount = 0;
        private int lastTabCount = 0;
        private Timer timer;
        private InventoryMonitor monitor;
    
        @Override
        public void onStart(){
            log("Starting MageTabs");
    
            state = "started";
            widgetIDs.put("Varrock", 11);
            widgetIDs.put("Camelot", 14);
            getWalking().setRunThreshold(Calculations.random(20, 70));
    
            lastTabCount = getInventory().count(tabType + " teleport");
            timer = new Timer();
            monitor = new InventoryMonitor(this);
    
            getSkillTracker().start(Skill.MAGIC);
        }
    
        private boolean openBank() {
            int i = Calculations.random(2);
    
            if (i == 0) {
                return getBank().open();
            } else {
                NPC banker = getNpcs().closest((npc) -> npc != null && npc.hasAction("Bank"));
    
                if (banker != null) {
                    sleep(500, 1500);
                    return banker.interact("Bank");
                }
    
                return false;
            }
        }
    
        private boolean doBank() {
            openBank();
    
            if (sleepUntil(() -> getBank().isOpen(), 3000)) {
                if (getBank().isOpen()) {
                    if (getBank().depositAllExcept(bankKeep)) {
                        if (sleepUntil(() -> getInventory().onlyContains(bankKeep), 3000)) {
                            if (getBank().withdrawAll("Soft clay")) {
                                sleepUntil(() -> getInventory().isFull(), 3000);
    
                                if (getInventory().isFull() && getBank().close()) {
                                    return sleepUntil(() -> !getBank().isOpen(), 3000);
                                }
                            }
                        }
                    }
                }
            }
    
            return false;
        }
    
        private boolean bank() {
            if (outsideVarrockBank.contains(getLocalPlayer())) {
                log("doing banking");
                return doBank();
            } else {
                log("walking to bank");
                getWalking().walk(outsideVarrockBank.getRandomTile());
                sleep(1500, 3500);
                return bank();
            }
        }
    
        private boolean insideBank() {
            return varrockBank.contains(getLocalPlayer());
        }
    
        private boolean insideVarrock() {
            return varrockSquare.contains(getLocalPlayer());
        }
    
        private boolean teleportToHouse() {
            log("teleporting to house");
    
           if (getInventory().interact("Teleport to house", "Break")) {
               if (sleepUntil(() -> !insideBank(), 10000)) {
                   log("teleported successfully");
                   return true;
               }
           }
    
            return false;
        }
    
        private boolean takePlayerPortal() {
            sleepUntil(() -> getGameObjects().closest("Portal") != null, 5000);
            GameObject portal = getGameObjects().closest("Portal");
    
            if (portal != null) {
                if (portal.interact("Enter")) {
                    return true;
                } else {
                    log("failed to interact with portal");
                }
            } else {
                log("couldn't find the portal :(");
            }
    
            return false;
        }
    
        private boolean teleportToHost() {
            log("teleporting to host");
            sleepUntil(() -> rimmingtonPortal.contains(getLocalPlayer()), 3000);
    
            if (rimmingtonPortal.contains(getLocalPlayer())) {
                sleepUntil(() -> getGameObjects().closest("Portal") != null, 5000);
                GameObject portal = getGameObjects().closest("Portal");
    
                if (portal != null) {
                    if (portal.interact("Enter")) {
                        if (sleepUntil(() -> getDialogues().getOptionIndex("Go to a friend's house") == 3, 5000)) {
    
                            if (getDialogues().chooseOption(3)) { // enter a friend's house
                                sleep(1500, 2500);
                                getKeyboard().type(hostName);
    
                                sleepUntil(() -> !(rimmingtonPortal.contains(getLocalPlayer())), 10000);
    
                                if (rimmingtonPortal.contains(getLocalPlayer())) {
                                    log("Couldn't join host's house. Try a different hose");
                                    this.stop();
                                } else {
                                    return true;
                                }
                            }
                        }
                    }
                } else {
                    log("no portal found");
                }
            } else {
                log("not at Rimmington portal");
            }
    
            return false;
        }
    
        private boolean backToHost() {
            if (teleportToHouse()) {
                if (takePlayerPortal()) {
                    return teleportToHost();
                }
            }
    
            return false;
        }
    
        private boolean teleportToVarrock() {
            log("teleporting to varrock");
    
            if (getInventory().interact("Varrock teleport", "Break")) {
                return sleepUntil(() -> insideVarrock(), 10000);
            }
    
            return false;
        }
    
        private Widget getWidget(int i) {
            Widget tabWidget = getWidgets().getWidget(i);
    
            if (tabWidget != null) {
                if (tabWidget.isVisible()) {
                    return tabWidget;
                }
            }
    
            return null;
        }
    
        private WidgetChild getWidgetChild(Widget parent, int child) {
            WidgetChild c = parent.getChild(child);
    
            if (c != null) {
                if (c.isVisible()) {
                    return c;
                }
            }
    
            return null;
        }
    
        private void saveLecternTile() {
            log("saving lectern tile");
            lecternTile = getLocalPlayer().getTile();
        }
    
        private boolean lecternInteract(GameObject lectern) {
            if (lectern.interact("Study")) {
                sleepUntil(() -> getWidget(TAB_WIDGET_ID) != null, 10000);
                Widget tabs = getWidget(TAB_WIDGET_ID);
    
                if (tabs != null) {
                    sleepUntil(() -> getWidgetChild(tabs, widgetIDs.get(tabType)) != null, 10000);
                    WidgetChild tab = getWidgetChild(tabs, widgetIDs.get(tabType));
    
                    if (tab != null) {
                        return tab.interact("Make-All");
                    }
                }
            }
    
            return false;
        }
    
        private boolean doTabbing() {
            if (getLocalPlayer().getAnimation() != -1) {
                return true;
            } else {
                log("Sleeping for animation");
                sleep(800); // potentially in the middle of the animation
                if (getLocalPlayer().getAnimation() != -1) {
                    return true;
                }
            }
    
            if (lecternTile != null) { // lectern has been used before
                if (lecternTile.distance() < 5) {
                    GameObject lectern = getGameObjects().closest("Lectern");
                    return lecternInteract(lectern);
                } else {
                    getWalking().walk(lecternTile);
                    sleep(500, 1000);
                }
    
                return false;
            } else {
                GameObject lectern = getGameObjects().closest("Lectern");
    
                if (lectern != null) {
                    if (lectern.distance() < 3) {
                        saveLecternTile();
                        return lecternInteract(lectern);
                    } else {
                        getWalking().walk(lectern);
                        sleep(500, 1000);
                    }
                } else {
                    log("Couldn't find a lectern!");
                }
    
                return false;
            }
        }
    
        private boolean hasClay() {
            return getInventory().count("Soft clay") > 0;
        }
    
        private void setRunThreshold() {
            if (getWalking().getRunEnergy() == 0) {
                getWalking().setRunThreshold(Calculations.random(20, 70));
            }
        }
    
        private void checkRequirements() {
            if (
                    (getInventory().count("Law rune") < 28) ||
                            (getInventory().count("Varrock teleport") < 2) ||
                            (getInventory().count("Teleport to house") < 2))
            {
                log("Stopping because you do not have enough law runes or tabs");
                this.stop();
            }
    
        }
    
        private void listenInventory() {
            monitor.updateContext(this);
    
            if (monitor.hasChanged()) {
                Item items[] = monitor.getChanges();
    
                for (Item i : items) {
                    if (i.getName().contains(tabType + " teleport")) {
                        if (i.getAmount() < lastTabCount) {
                            lastTabCount = i.getAmount();
                        } else {
                            tabCount += i.getAmount() - lastTabCount;
                            lastTabCount = i.getAmount();
                        }
    
                    }
                }
            }
        }
    
        @Override
        public int onLoop() {
            listenInventory();
            getDialogues().clickContinue();
            checkRequirements();
            setRunThreshold();
    
            if (!hasClay()) {
                if (state.equals("banking")) {
                    if (bank()) {
                       if (backToHost()) {
                           state = "tabbing";
                       }
                    }
                } else {
                    if (teleportToVarrock()) {
                        state = "banking";
                    }
                }
            } else {
                doTabbing();
            }
    
            return Calculations.random(300, 500);
        }
    
        @Override
        public void onExit() {
            log("Bye");
        }
    
        @Override
        public void onPaint(Graphics g) {
            Font font = new Font("Times new roman", Font.PLAIN, 15);
    
            Color bg = new Color(155, 155, 155, 127); // grey transparent
    
            g.setColor(bg);
            g.fillRect(5, 5, 510, 80);
            g.setFont(font);
            g.setColor(Color.BLUE);
            g.drawString("Time: ", 10, 25);
            g.setColor(Color.WHITE);
            g.drawString(timer.formatTime(), 100, 25);
            g.setColor(Color.BLUE);
            g.drawString("Tabs made: ", 10, 45);
            g.setColor(Color.WHITE);
            g.drawString(tabCount + " (" + timer.getHourlyRate(tabCount) + ")", 100, 45);
            g.setColor(Color.BLUE);
            g.drawString("Magic xp: ", 10, 65);
            g.setColor(Color.WHITE);
            g.drawString(getSkillTracker().getGainedExperience(Skill.MAGIC) + " (" + getSkillTracker().getGainedExperiencePerHour(Skill.MAGIC) + ")", 100, 65);
        }
    }
    
    
    
    Edited by jmarsiglio2
    Link to comment
    Share on other sites

    Nice releases so far. Are you planning on putting them to SDN?

     

    I'm not sure how to do that haha :D

     

    My RockCrab script can go on the SDN but this one still needs a couple of changes until it's ready

    Edited by jmarsiglio2
    Link to comment
    Share on other sites

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
     Share

    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.