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
  • [ F2P ] [ FREE ] [SOURCE ] RSMasterGuard Beer Glass Collector


    Recommended Posts

    Posted (edited)

    RSMasterGuard Beer Glass Collector

     

    Features

    Collects beer glasses from a shelf in Al Kharid.

     

    Requirements

    • None

     

    Starting Instructions

    • Start the mod in Al Kharid and walk away, the bot will take care of the rest.

     

    [Source] - FOR EDUCATION PURPOSE ONLY, USE THE SDN SCRIPT TO AVOID ERRORS!

    import org.dreambot.api.methods.interactive.GameObjects;
    import org.dreambot.api.methods.map.Area;
    import org.dreambot.api.methods.map.Tile;
    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.methods.Calculations;
    import org.dreambot.api.utilities.Timer;
    import java.awt.*;
    
    @ScriptManifest(name = "Al Kharid Beer Glass Collector", description = "Searches for Beer Glasses in Al Kharid", author = "RSMasterGuard",
            version = 1.0, category = Category.MONEYMAKING, image = "")
    public class CollectBeerGlasses extends AbstractScript {
        private Timer timer = new Timer();
        private final Area BANK_AREA = new Area(3269, 3170, 3272, 3164);
        private final Area HOUSE_AREA = new Area(3322, 3138, 3319, 3140);
        private final Area OUTSIDE_HOUSE_AREA = new Area(3318, 3148, 3323, 3143);
        private final Area LOOTING_AREA = new Area(3319, 3137, 3319, 3137);
        private Tile BANK_TILE = new Tile(3270, 3167, 0);
        private Tile ROOM_TILE = new Tile(3321, 3139, 0);
        private Tile OUTSIDE_TILE = new Tile(3321, 3139, 0);
        private String status = "";
        private String doorStatus = "Closed";
        State state;
    
        private State getState()
        {
            if (getInventory().emptySlotCount() == 0)
            {
                if (BANK_AREA.contains(getLocalPlayer()))
                {
                    doorStatus = "Closed";
                    return State.BANK;
                }
                if(doorStatus == "Closed")
                {
                    doorStatus = "Open";
                    return State.OPEN_DOOR;
                }
                else
                {
                    return State.WALK_TO_BANK;
                }
            } else
            {
                if (BANK_AREA.contains(getLocalPlayer()))
                {
                    return State.WALK_TO_OUTSIDE_FURNACE;
                }
                if (OUTSIDE_HOUSE_AREA.contains(getLocalPlayer()))
                {
                    if(doorStatus == "Closed")
                    {
                        doorStatus = "Open";
                        return State.OPEN_DOOR;
                    }
                    else
                    {
                        return State.WALK_TO_FURNACE;
                    }
                }
                if (HOUSE_AREA.contains(getLocalPlayer()))
                {
                    return State.LOOT_GLASSES;
                }
                if (LOOTING_AREA.contains(getLocalPlayer()))
                {
                    return State.LOOT_GLASSES;
                }
                if(doorStatus == "Closed")
                {
                    return State.WALK_TO_OUTSIDE_FURNACE;
                }
            }
            return state;
        }
    
        public enum State
        {
            NOTHING,WALK_TO_BANK, WALK_TO_FURNACE, BANK, LOOT_GLASSES,OPEN_DOOR,WALK_TO_OUTSIDE_FURNACE,
        }
    
        @Override
        public int onLoop()
        {
            if (!getWalking().isRunEnabled() && getWalking().getRunEnergy() > 50)
            {
                getWalking().toggleRun();
            }
            if (getInventory().isItemSelected())
            {
                getInventory().deselect();
            }
            switch (getState())
            {
                case NOTHING:
                    break;
    
                case WALK_TO_BANK:
                    status = "Walking to bank";
                    getWalking().walk(BANK_TILE);
                    sleepUntil(() -> getLocalPlayer().distance(BANK_TILE) < 5, 5000);
                    break;
                case BANK:
                    status = "Banking";
                    getBank().openClosest();
                    getBank().depositAllItems();
                    sleep(3000);
                    break;
                case WALK_TO_FURNACE:
                    status = "Walking to Area";
                    getWalking().walk(ROOM_TILE);
                    sleepUntil(() -> getLocalPlayer().distance(ROOM_TILE) < 2, 5000);
                    break;
                case WALK_TO_OUTSIDE_FURNACE:
                    status = "Walking to Area Outside";
                    getWalking().walk(OUTSIDE_TILE);
                    sleepUntil(() -> getLocalPlayer().distance(OUTSIDE_TILE) < 2, 5000);
                    break;
                case OPEN_DOOR:
                    status = "Opening Door";
                    GameObject Door = GameObjects.closest("Door");
                    Door.interact("Open");
                    break;
                case LOOT_GLASSES:
                    status = "Looting Beer Glasses";
                    GameObject Shelves = GameObjects.closest("Shelves");
                    Shelves.interact("Search");
                    sleep(Calculations.random(3000, 5000));
                    break;
            }
            return 1000;
        }
    
        @Override
        public void onPaint(Graphics g) {
            g.setColor(Color.WHITE);
            g.drawString("Runtime: " + timer.formatTime(), 25, 40);
            g.drawString("State: " + status, 25, 60);
        }
    }

     

    Edited by RSMasterGuard
    Link to comment
    Share on other sites

    Just improved this code and will submit to SDN. If anyone is interested in seeing what the final product looks like reply and I'll post!

    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.