Jump to content

Kebbit Hunter script (Help with ConditionalSleeps)


Imthabawse

Recommended Posts

Having trouble making a ConditionalSleep for my catchKebbit method and retrieveKebbit method. Any suggestions? Just got standard sleep(randoms) for now which works but wouldn't wanna run to long this way. Perhaps for such a standard script it wont really matter though..? Also for dropping method is there a way to drop items from top to bottom instead of always left to right? Or just randomize it better? Also realizing the bot will go for another players falcon as well so will only work in an empty world as it sits ?

Code:

private Area huntingArea = new Area(2365, 3596, 2393, 3575);


    private void catchKebbit() throws InterruptedException {
        NPC spottedKebbit = getNpcs().closest("Spotted kebbit");
        NPC falcon = getNpcs().closest("Gyr Falcon");

        if (!myPlayer().isAnimating() && !myPlayer().isMoving() && getEquipment().isWearingItemThatContains(EquipmentSlot.WEAPON, "Falconer's glove") && !getInventory().isFull() && spottedKebbit != null && falcon == null) {
            log("Catching Kebbit...");
            spottedKebbit.interact("Catch");
            sleep(random(2500, 3000));
        }
    }

     private void retrieveKebbit() throws InterruptedException {
         NPC caughtKebbit = getNpcs().closest("Gyr Falcon");

         if (!myPlayer().isAnimating() && !myPlayer().isMoving() && !getInventory().isFull() && caughtKebbit != null) {
             log("Retrieving Kebbit...");
             caughtKebbit.interact("Retrieve");
             sleep(random(2500, 3000));
         }
     }


    private void dropAll() {
        if(getInventory().isFull() && !myPlayer().isAnimating() && !myPlayer().isMoving()) {
            log("Inventory FULL.. dropping fur's and bones...");
            getInventory().dropAllExcept("Dramen staff","Varrock teleport","Stamina potion(4)","Coins");
        }
    }


    @Override
    public int onLoop() throws InterruptedException {
        if(huntingArea.contains(myPlayer())) {
            catchKebbit();
            retrieveKebbit();
            dropAll();
        }else{
            stop();
        }
        return 1000;
    }
}
Edited by Imthabawse
Link to comment
Share on other sites

I'm guessing this is hunting - don't really know much about it.

I'm not sure the difference between catching and receiving a kebbit. But in any case, you want to create a conditional sleep such that you sleep until you're inventory contains x + 1 kebbits. So you would need a variable representing the previous count, X, and sleep until getCurrentKebbitCount() == X + 1.

  • Like 1
Link to comment
Share on other sites

9 hours ago, dreameo said:

I'm guessing this is hunting - don't really know much about it.

I'm not sure the difference between catching and receiving a kebbit. But in any case, you want to create a conditional sleep such that you sleep until you're inventory contains x + 1 kebbits. So you would need a variable representing the previous count, X, and sleep until getCurrentKebbitCount() == X + 1.

When you "Retrieve" a Kebbit in this case Spotted Kebbit you get a bone and a fur in your inventory so you got me thinking on the right path just gotta figure out how to write it. 

 

Something along the lines of sleep until getInventory.contains +1 bones +1furs 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...