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
  • Check if item exists ?


    maxBot90

    Recommended Posts

    Hello, I just started working on wine of zammy grab script , but my problem is unless I hard code some timers I cant get it to work flawless and my issue is I cant do ground items check as it always returns null for me and cause crashes using many different methods , like using exist() function or any way I can detect it to spawn other than hard coding . So I'd like to see some snippets to perfectly detect Item if found so I can use it on different conditions , also I have done a cow script which loot cowhides and I based it on distance of cowhide only which seems sucks but thats the only issure bellow is some snippet I tried and it always returns null or cause crash.

    (Contains many stuff as I am trying many different things so dont judge 😜 

    import org.dreambot.api.methods.Calculations;
    import org.dreambot.api.methods.magic.Normal;
    import org.dreambot.api.methods.magic.Spell;
    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.tabs.Tab;
    import org.dreambot.api.script.AbstractScript;
    import org.dreambot.api.script.Category;
    import org.dreambot.api.script.ScriptManifest;
    import org.dreambot.api.script.listener.AdvancedMessageListener;
    import org.dreambot.api.wrappers.interactive.Entity;
    import org.dreambot.api.wrappers.interactive.NPC;
    import org.dreambot.api.wrappers.items.GroundItem;
    import org.dreambot.api.wrappers.widgets.message.Message;
    import org.dreambot.api.methods.filter.Filter;
    
    import java.awt.*;
    import java.util.Random;
    
    
    @ScriptManifest(author = "Me", name = "My Script", version = 1.0, description = "Easy Cows", category = Category.COMBAT)
    
    
    
    public final class myScript extends AbstractScript implements AdvancedMessageListener {
    
        private Area cowArea = new Area(new Tile(3253, 3255), new Tile(3265, 3255), new Tile(3265, 3296), new Tile(3240, 3297), new Tile(3246, 3278), new Tile(3253, 3272));
        private Area lumbridgeBank = new Area(3210, 3218, 3207, 3220, 2);
        private Area hillArea = new Area(new Tile(3114, 9851), new Tile(3108, 9844), new Tile(3106, 9839), new Tile(3101, 9838), new Tile(3097, 9835), new Tile(3098, 9837), new Tile(3097, 9831), new Tile(3100, 9828), new Tile(3103, 9827), new Tile(3108, 9827), new Tile(3111, 9829), new Tile(3114, 9831), new Tile(3117, 9834), new Tile(3119, 9838), new Tile(3121, 9842), new Tile(3124, 9845), new Tile(3123, 9848), new Tile(3119, 9851), new Tile(3117, 9853));
        private Area hillRoom = new Area(new Tile(3117, 3452), new Tile(3115, 3451), new Tile(3115, 3450), new Tile(3116, 3450));
        private Area frontRoom = new Area(new Tile(3114, 3449), new Tile(3114, 3447), new Tile(3116, 3447), new Tile(3117, 3449), new Tile(3116, 3449), new Tile(3115, 3449));
        private Area varrockWestBank = new Area(3180, 3447, 3185, 3433);
        private Area upLadder = new Area(new Tile(3116, 9851), new Tile(3117, 9851), new Tile(3117, 9852), new Tile(3117, 9853), new Tile(3116, 9853), new Tile(3115, 9853), new Tile(3115, 9851));
        private Area edgevillageBank = new Area(3098, 3499, 3091, 3488);
        private Area zammy = new Area(new Tile(2957, 3819), new Tile(2953, 3819), new Tile(2950, 3817), new Tile(2950, 3818), new Tile(2948, 3820), new Tile(2949, 3822), new Tile(2953, 3822), new Tile(2957, 3822));
        private Area edgy = new Area(new Tile(2940, 3517), new Tile(2939, 3517), new Tile(2938, 3517), new Tile(2937, 3517), new Tile(2936, 3517), new Tile(2935, 3517), new Tile(2935, 3516), new Tile(2931, 3516), new Tile(2931, 3514), new Tile(2936, 3514));
        private Area safey = new Area(new Tile(2941, 3514), new Tile(2941, 3515), new Tile(2942, 3515), new Tile(2942, 3516), new Tile(2942, 3517), new Tile(2944, 3518), new Tile(2944, 3517));
        private GroundItem bones ;
    
        public void onStart() {
    
            log("Started !");
    
        }
        private enum cases {
            onCow,
            walkBank,
            walkCow,
            walkFirst,
            banking,
            waitForS,
            Loot
    
        };
    
    
    
    
    
    
    
    
    
        private cases getCases() {
    
            if (zammy.contains(getLocalPlayer()) && getInventory().isFull()) {
                return cases.walkBank;
            }
            if (edgevillageBank.contains(getLocalPlayer()) && getInventory().isFull()) {
                return cases.banking;
            }
            if (edgevillageBank.contains(getLocalPlayer()) && getInventory().contains("Law rune") && !getInventory().isFull()) {
                return cases.walkCow;
            }
            if((zammy.contains(getLocalPlayer())&& !getInventory().isFull())){
                return cases.onCow;
            }
    
            log("no case !");
    
            return cases.waitForS; //Wait and Chill for something
        }
    
    
        public void onExit() {
    stop();
        }
    
    
        @Override
    
        public int onLoop() {
            switch (getCases()) {
                case walkCow:
                    log("got it");
                    while (!zammy.contains(getLocalPlayer())) {
                        Random rand = new Random();
                        int ranT = rand.nextInt(4);
                        getWalking().walk(zammy.getRandomTile());
                        sleepUntil(() -> (getWalking().getDestinationDistance() < ranT), 20000);
                        sleep(Calculations.random(800, 1800));
                    }
                    break;
                case onCow:
                    Random rand = new Random();
                    int randN = rand.nextInt(10);
                  /*  if (randN == 0) {
                        log("AntiBan : Camera");
                        getCamera().rotateToYaw(Calculations.random(0, 80));
                    } /* else if (randN == 1) {
                        log("AntiBan : Over Skill");
    
                        getTabs().open(Tab.STATS);
                        getSkills().hoverSkill(Skill.MAGIC);
                        sleep(Calculations.random(3000, 5500));
                        getTabs().open(Tab.INVENTORY);
                    }
    */
                    bones = getGroundItems().closest("Wine of zamorak");
    
    
                    if (bones != null) {
        getMagic().castSpellOn(Normal.TELEKINETIC_GRAB , bones);
        sleep(Calculations.random(500, 800));
        sleepUntil(() -> (!bones.exists()) , 10000);
                }
                    log("The long sleep ?");
                    sleep(Calculations.random(500, 800));
                    sleepUntil(() -> bones != null, 30000);
                    
    /* if (bones == null && !safey.contains(getLocalPlayer())) {
        getWalking().walk(safey.getRandomTile());
    
    }*/
    
    
    
        int n = getInventory().count("Wine of zamorak");
        log("Collected: " + n);
        getTabs().open(Tab.INVENTORY);
    
    
    
    
                  /*  while(!getGroundItems().closest("Wine of zamorak ").exists()) {
    
                        List<Player> playerList = getPlayers().all();
                        playerList.forEach(p -> {
                            log(p.getName());
                        });
    
                    }
    */
                    break;
                case walkBank:
                    while (!edgevillageBank.contains(getLocalPlayer())) {
                        getWalking().walk(edgevillageBank.getRandomTile());
                        sleepUntil(() -> getWalking().getDestinationDistance() < 3, 10000);
                        sleep(300, 400);
                    }
    
                    break;
                case banking:
                    getBank().open();
                    getBank().depositAllItems();
                    sleepUntil(() -> getInventory().isEmpty(), 10000);
                    log("Taking bank break " + getClient().getCurrentTime());
                    sleep(Calculations.random(140000, 240000));
                    log("Finishied Breaking !" + getClient().getCurrentTime());
                    getBank().withdraw("Law rune", 28);
                    sleep(Calculations.random(10000, 20000));
                    break;
            }
            return Calculations.random(2000, 4000);
        }
        @Override
        public void onTradeMessage(Message message) {
            // TODO Auto-generated method stub
    
        }
    
        @Override
        public void onAutoMessage(Message arg0) {
            // TODO Auto-generated method stub
    
        }
    
        @Override
        public void onClanMessage(Message arg0) {
            Random randd = new Random();
            int ideas = randd.nextInt(3);
    
            if (arg0.getMessage().contains("Attempting to kick player from friends chat...") && ideas == 0) {
                log("LMAO ?!");
                getKeyboard().type("/LMFAO!");
            } else if (arg0.getMessage().contains("Attempting to kick player from friends chat...") && ideas == 1) {
                log("DAMN");
                getKeyboard().type("/Damn, LOOOOOL !");
            } else if (arg0.getMessage().contains("Attempting to kick player from friends chat...") && ideas == 2) {
                log("RIP ?!");
                getKeyboard().type("/RIP LMAO !");
            }
        }
    
        @Override
        public void onGameMessage(Message mee) {
            // TODO Auto-generated method stub
         
        }
    
        @Override
        public void onPlayerMessage(Message arg0) {
            // TODO Auto-generated method stub
    
        }
    
        @Override
        public void onPrivateInMessage(Message arg0) {
            // TODO Auto-generated method stub
    
        }
    
        @Override
        public void onPrivateInfoMessage(Message arg0) {
            // TODO Auto-generated method stub
    
        }
    
        @Override
        public void onPrivateOutMessage(Message arg0) {
            // TODO Auto-generated method stub
    
        }
    
    }

     

    Link to comment
    Share on other sites

    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.