Jump to content

YewChopper (Randomly logged out)


Recommended Posts

Posted (edited)

So made a Yew chopping script that chops and banks yew logs. For some odd reason the bot logged out twice now that I've been running it. The first time I got this error in the Logger:

 

Spoiler

[INFO][Bot #1][04/18 11:28:46 AM]: Script WillowChopper has exited!
[ERROR][Bot #1][04/18 11:28:46 AM]: Error on random solver onLoop() : Auto Login
java.lang.InterruptedException: sleep interrupted
    at java.lang.Thread.sleep(Native Method)
    at org.osbot.rs07.event.RandomExecutor.run(pg:178)
    at java.lang.Thread.run(Unknown Source)

The second time the Logger didn't produce an error. Anyone know why this would happen? Currently running script to see if problem reoccurs.

Code:

Spoiler

import org.osbot.rs07.api.map.Area;
import org.osbot.rs07.api.map.constants.Banks;
import org.osbot.rs07.api.model.Entity;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import org.osbot.rs07.utility.ConditionalSleep;

@ScriptManifest(author = "Imthabawse", info = "Chops N Drops willow logs for gains", logo = "", name = "WillowChopper", version = 1)


public class WillowChopper extends Script {


    private Area yewArea = new Area(2751, 3436, 2769, 3425);


    private void chop() throws InterruptedException {
        Entity yew = getObjects().closest(yewArea,"Yew");
        Entity nest = getGroundItems().closest("Bird nest");

        if(!myPlayer().isAnimating() && !myPlayer().isMoving() && !getInventory().isFull() && yew != null && nest == null) {
            log("Chopping tree...");
           sleep(random(200,400));
            yew.interact("Chop down");
            new ConditionalSleep(5500) {
                @Override
                public boolean condition() {
                    return myPlayer().isAnimating() || !yew.exists() ;
                }
            }.sleep();
        sleep(random(500,800));
        log("Moving mouse off-screen...");
        getMouse().moveOutsideScreen();
        }
    }

    private void bank() throws InterruptedException {
        if(getInventory().isFull() && !myPlayer().isAnimating() && !myPlayer().isMoving()) {
            sleep(random(400,800));
            log("Walking to bank...");
            getWalking().webWalk(Banks.CATHERBY);
            sleep(random(400,800));
            log("Opening bank..");
            getBank().open();
            log("Depositing logs...");
            getBank().depositAll("Yew logs","Bird nest");
            sleep(random(400,800));
            log("Closing bank..");
            getBank().close();
        }
    }

    private void nest() throws InterruptedException {
        Entity nest = getGroundItems().closest("Bird nest");

        if(nest != null && !getInventory().isFull()) {

            sleep(random(600,900));
            log("Picking up Birds nest..");
            nest.interact("Take");
        }
    }


    @Override
    public void onStart() {
        getCamera().toTop();
        log("Welcome to YewChopper! Enjoy the EXP!");
    }

    @Override
    public void onExit() {
        log("Thanks for using YewChopper :)");
    }

    @Override
    public int onLoop() throws InterruptedException {
if(yewArea.contains(myPlayer()) && !getInventory().isFull()) {
    chop();
    nest();
}else if(!yewArea.contains(myPlayer()) && !getInventory().isFull()) {
    log("Let's get back to chopping!");
    getWalking().webWalk(yewArea);
        }else{
        bank();
}

        return 500;
    }
}

Edit: Bot logged out in the middle of chopping.. nothing in logger script still running.

Edited by Imthabawse
Posted
12 minutes ago, Imthabawse said:

So you're saying because I haven't manually interacted with the bot within 5 minutes it's logging out? Not really sure what you're saying here but the bot will run fine for awhile chopping yew's and banking then randomly log's out. Haven't tinkered with it yet but I'll get to the bottom of it :]

Edit: Where'd you get 5 minutes from anyhow?

If your not in combat you have to click before 5 minute timer kicks you out, if you are in combat i think its 20 minutes, but it could be 15.

  • Like 1
Posted

Currently testing this ?

Spoiler

private void idleTest() throws InterruptedException {
   Entity yewTree = getObjects().closest("Yew");

    if (!getMouse().isOnScreen()) {
        log("Idle to long.. Interacting with tree.");
        sleep(random(240000,245000));
        yewTree.interact("Chop down");


    }
}

Gonna let it run for awhile see if it works or not. 

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
  • Recently Browsing   0 members

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