Jump to content
Sign in to follow this  
Xuubasa

Check if Object has been removed/depleted

Recommended Posts

I'm making a mule that does multiple actions during idle time. I have basic scripts for fishing, mining, woodcutting and flax gathering so far. 
The one issue i'm having is figuring out when an object or ID has been 'used' - when a tree has been chopped, flax picked etc. Any advice is welcome. Thanks!

 

private static boolean gatherFlax() {
    long timer = System.nanoTime();
    while(running && !Inventory.isFull() && !isFlaxTimedOut(timer)) {
        RSObject[] flaxPlants = Objects.findNearest(Constants.FLAX_FIND_RANGE, Constants.FLAX_OBJECT_ID);
        if (flaxPlants.length > 0) {
            while(flaxPlants[0] != null && flaxPlants[0].isClickable() && !Inventory.isFull()) {
                flaxPlants[0].click();
                Constants.randSleep();
            }
        }
    }
    return isFlaxTimedOut(timer);
}

Share this post


Link to post
Share on other sites
RSObject[] flaxPlants = Objects.findNearest(Constants.FLAX_FIND_RANGE, Constants.FLAX_OBJECT_ID);

ourPlant = flaxPlants[0];

ourPlant.click();

RSObject[] flaxPlants = Objects.findNearest(Constants.FLAX_FIND_RANGE, Constants.FLAX_OBJECT_ID);

if (!flaxPlants.contains(ourPlant)) {

depleted = true;

}

Share this post


Link to post
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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×