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
  • help on script.


    DontGetBanned

    Recommended Posts

    cant seem to get my looting method down...

    when NPC is killed, the script will either find a new target before looting, or loot.

    When it does loot, it tends to pick up the first item and not the item i want looted.

    example: Kill a cow, instead of looting the cowhide it would loot the raw meat even though i dont have raw meat anywhere mentioned in the code and it carrys on with finding a new target and attacking that.

    i think i have something wrong with this bit of code

     

        private final static String[] Loot = {"Cow hide", "Bone"};
        private final String Take = "Take";

        private void Loot() {
            if(getGroundItems().closest(Loot) != null ) {
                    getGroundItems().closest(LootFilter).interact(Take);
            }
            sleep(Calculations.random(1000,5000));
        }
     

    if someone can help correct me on this, to make it loot the list of Loot

    im not using this for killing cows, but this an example im using

    Link to comment
    Share on other sites

    On 2/9/2020 at 6:44 PM, BANME said:

    where is LootFilter ?

    private void Loot() {
            if(getGroundItems().equals(Loot)) {
                    getGroundItems().all(LootFilter);//.interact(Take);
                    sleep(Calculations.random(1000,2000));
            }
            GameState = State.WAIT;
        }
       public static final Filter<GroundItem> LootFilter = new Filter<GroundItem>() {
            @Override
            public boolean match(GroundItem grounditem) {
                if(grounditem == null) {
                    return false;
                }
                if(grounditem.getName().equals(Loot)) {
                    return true;
                }
                return false; 
            }
        };

    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.