Jump to content

A Beginners Guide to Writing OSBot Scripts (where to get started!) by Apaec


Recommended Posts

  • 3 weeks later...
Posted (edited)

Just asking how i can get any item what are in the bank?

 

Thx

public int onLoop() throws InterruptedException {
		switch (getState()) {
		case BANK:
			Entity stall = objects.closest("Bank Booth");
			if (stall != null) {
				stall.interact("Bank");
			}
			break;
		case GET:
			bank.getItem("Maple Logs");
			break;
		case WAIT:
			sleep(random(500, 700));
			break;
		default:
			break;
		}
		return random(200, 300);
Edited by kerklais
Posted

Just asking how i can get any item what are in the bank?

Thx

public int onLoop() throws InterruptedException {		switch (getState()) {		case BANK:			Entity stall = objects.closest("Bank Booth");			if (stall != null) {				stall.interact("Bank");			}			break;		case GET:			bank.getItem("Maple Logs");			break;		case WAIT:			sleep(random(500, 700));			break;		default:			break;		}		return random(200, 300);
This will withdraw a specific number

getBank().withdraw("item", 5);

This will withdraw all

getBank().withdrawAll("item");

  • 3 weeks later...
  • 1 month later...
Posted

Trying to make a barbarian power fisher! The bot drops all of the fish but it doesn't try to fish them!

 

private enum State {

FISH, DROP, WAIT

};

 

private State getState() {

Entity fishspot = objects.closest("Fishing spot");

if (!inventory.isEmptyExcept("Feather","Barbarian rod"))

return State.DROP;

if (fishspot != null)

return State.FISH;

return State.WAIT;

}

 

@Override

public int onLoop() throws InterruptedException {

switch (getState()) {

case FISH:

Entity fishspot = objects.closest("Fishing spot");

if (fishspot != null) {

fishspot.interact("Use-rod");

}

break;

case DROP:

inventory.dropAll("Leaping trout","Leaping salmon","Leaping sturgeon");

break;

case WAIT:

sleep(random(500, 700));

break;

}

return random(200, 300);

}

Posted

Trying to make a barbarian power fisher! The bot drops all of the fish but it doesn't try to fish them!

 

private enum State {

FISH, DROP, WAIT

};

 

private State getState() {

Entity fishspot = objects.closest("Fishing spot");

if (!inventory.isEmptyExcept("Feather","Barbarian rod"))

return State.DROP;

if (fishspot != null)

return State.FISH;

return State.WAIT;

}

 

@Override

public int onLoop() throws InterruptedException {

switch (getState()) {

case FISH:

Entity fishspot = objects.closest("Fishing spot");

if (fishspot != null) {

fishspot.interact("Use-rod");

}

break;

case DROP:

inventory.dropAll("Leaping trout","Leaping salmon","Leaping sturgeon");

break;

case WAIT:

sleep(random(500, 700));

break;

}

return random(200, 300);

}

Entity fishspot = objects.closest("Fishing spot");
if (fishspot != null) {
fishspot.interact("Use-rod");
}

fishing spots are NPC's

 

so

NPC fishspot = objects.closest("Fishing spot");
if (fishspot != null) {
fishspot.interact("Use-rod");
}

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