Jump to content

How do i make my script STOP and not just stop moving


Recommended Posts

Posted (edited)

Dear scripters,

I ran into a small problem while learning to code, so basically i'm just making a script that walks to the G.E and use's bank on the banker.

Problem : After that, the script is still running but doesn't move, i want it to stop and not logout my account.

@Override
public void onStart() {
log("Let's get started!");
}

@Override
public int onLoop() throws InterruptedException {
getWalking().webWalk(new Position(3166, 3485, 0));
npcs.closest("Banker").interact("Bank");
stop(false);
return random(200, 300);

}

@Override
public void onExit() {
log("Arrived at destination !");
}

@Override
public void onPaint(Graphics2D g) {

}
}

Could someone explain this, and how i make the script stop when it has interacted with the banker ?

 

Thanks

Edited by Takes A Nap
Posted (edited)


stop(false);


@Override

public void onStart() {

log("Let's get started!");

}

@Override

public int onLoop() throws InterruptedException {

getWalking().webWalk(new Position(3166, 3485, 0));

if (npcs.closest("Banker") != null && npcs.closest("Banker").interact("Bank")){

stop(false);

}

return random(200, 300);

}

@Override

public void onExit() {

log("Arrived at destination !");

}

@Override

public void onPaint(Graphics2D g) {

}

}

Edited by Sinatra
Posted

I guess you could try this

@Override
public int onLoop() {
    if (bank.isOpen()) {
        stop(false);
    } else if (npcs.closest("Banker") == null || myPosition().distance(new Position(3166, 3485, 0)) > 10) {
        walking.webWalk(new Position(3166, 3485, 0));
    } else {
        npcs.closest("Banker").interact("Bank");
    }
    return 69;
}
  • Like 1
Posted

 

I guess you could try this

@Override
public int onLoop() {
    if (bank.isOpen()) {
        stop(false);
    } else if (npcs.closest("Banker") == null || myPosition().distance(new Position(3166, 3485, 0)) > 10) {
        walking.webWalk(new Position(3166, 3485, 0));
    } else {
        npcs.closest("Banker").interact("Bank");
    }
    return 69;
}

Oke lol this thing is fast haha, and it stops the script thanks alot !

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...