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
  • Used ChatGPT to write a rogues den safe cracker script.


    Aniwidgets

    Recommended Posts

    Posted

    Im not sure how to add it to the bot, I also dont have the requirements to even test it. Looking at the code it looks like it might bank after getting just one gem in your inventory so will need some edits.

     

    import org.dreambot.api.methods.Calculations;
    import org.dreambot.api.methods.container.impl.bank.Bank;
    import org.dreambot.api.methods.container.impl.bank.BankLocation;
    import org.dreambot.api.methods.interactive.GameObjects;
    import org.dreambot.api.methods.interactive.NPCs;
    import org.dreambot.api.methods.map.Area;
    import org.dreambot.api.methods.map.Tile;
    import org.dreambot.api.methods.walking.path.impl.LocalPath;
    import org.dreambot.api.methods.walking.web.node.impl.bank.WebBank;
    import org.dreambot.api.methods.walking.web.node.impl.bank.WebBankNode;
    import org.dreambot.api.methods.walking.web.node.impl.bank.WebBankPath;
    import org.dreambot.api.methods.walking.web.node.impl.bank.WebBankUtils;
    import org.dreambot.api.methods.walking.web.path.impl.LocalWebPath;
    import org.dreambot.api.script.AbstractScript;
    import org.dreambot.api.script.Category;
    import org.dreambot.api.script.ScriptManifest;
    import org.dreambot.api.wrappers.interactive.GameObject;
    import org.dreambot.api.wrappers.interactive.NPC;
    
    @ScriptManifest(category = Category.THIEVING, name = "Safe Cracker", author = "Your Name", version = 1.0)
    public class SafeCracker extends AbstractScript {
    
        private static final int[] GEMS = {1623, 1621, 1619, 1617}; // Uncut gems to bank
        private static final int LOCKPICK_ID = 1523; // Lockpick item id
    
        private static final Tile[] ROGUES_DEN_PATH = {new Tile(3049, 4969, 0), new Tile(3052, 4971, 0), new Tile(3056, 4971, 0), new Tile(3060, 4972, 0), new Tile(3064, 4973, 0), new Tile(3068, 4973, 0), new Tile(3072, 4973, 0), new Tile(3072, 4977, 0), new Tile(3071, 4981, 0), new Tile(3070, 4985, 0), new Tile(3070, 4989, 0), new Tile(3069, 4993, 0), new Tile(3070, 4997, 0), new Tile(3070, 5001, 0)};
        private static final Tile ROGUES_DEN_BANK_TILE = new Tile(3055, 4975, 0);
        private static final Area ROGUES_DEN_AREA = new Area(3044, 4974, 3070, 5001);
    
        private static final int CHEST_ID = 7236;
        private static final int SAFECRACKER_ID = 2240;
    
        private NPC safecracker;
        private GameObject safe;
    
        @Override
        public int onLoop() {
            if (!ROGUES_DEN_AREA.contains(getLocalPlayer())) {
                walkToRoguesDen();
            } else if (hasGems()) {
                bankGems();
            } else {
                crackSafe();
            }
            return Calculations.random(500, 1000);
        }
    
    private void walkToRoguesDen() {
            LocalWebPath path = WebBankPath.buildTo(ROGUES_DEN_TILE);
            if (path != null) {
                path.walk();
            } else {
                log("Unable to find path to Rogue's Den");
            }
        }
    
        private void crackSafe() {
            if (safecracker == null || !safecracker.exists()) {
                safecracker = NPCs.closest(SAFECRACKER_ID);
            }
            if (safe == null || !safe.exists()) {
                safe = GameObjects.closest(CHEST_ID);
            }
            if (!safe.hasAction("Crack")) {
                safe = null;
            }
            if (safecracker != null && safe != null) {
                if (safe.distance(safecracker) > 4) {
                    walkTo(safe.getTile());
                } else if (getLocalPlayer().getAnimation() == -1) {
                    safe.interact("Crack");
                    sleepUntil(() -> getLocalPlayer().getAnimation() == -1, Calculations.random(2000, 3000));
                }
            }
        }
    
        private boolean hasGems() {
            for (int gem : GEMS) {
                if (getInventory().contains(gem)) {
                    return true;
                }
            }
            return false;
        }
    
        private void bankGems() {
            if (getBank().isOpen()) {
                for (int gem : GEMS) {
                    Bank.depositAllExcept(LOCKPICK_ID, GEMS);
                }
                sleepUntil(() -> !getInventory().contains(GEMS), Calculations.random(2000, 3000));
            } else {
                WebBank.open(BankLocation.ROGUES_DEN);
            }
        }
    
    }

     

    • 2 weeks later...
    Posted

    This code is shit, dont use it. Learn java first

    Posted
    On 3/16/2023 at 9:58 PM, Hoodz said:

    This code is shit, dont use it. Learn java first

    Blunt, but true

    Archived

    This topic is now archived and is closed to further replies.

    ×
    ×
    • 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.