Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Script does nothing

Featured Replies

5 hours ago, liverare said:

Whoever keeps telling new scripters to use states - stop it.

You've made this new guy's script so fucking unreadable and overly complicated that I would be aghast if he can even get it to work.

States are horrible! Stop using them!

Here's what I can do without states; compare for yourself:


String status = "Ready"

Position cowTile = new Position(3259, 3269, 0);
NPC banker;
NPC cow;

@Override
public void onLoop() throws InterruptedException {
	if (shouldGoToBank()) {
		goToBank();
	} else if (shouldWithdrawFood()) {
		withdrawFood();
	} else if (shouldGoToCows()) {
		goToCows();
	} else if (shouldKillCows()) {
		killCows();
	}
}

private boolean shouldGoBank() {
	return inventory.isEmpty();
}

private void goToBank() {
	status = "Going to the bank";
	getWalking().webWalk(Banks.LUMBRIDGE_UPPER);
}

private boolean shouldWithdrawFood() {
	return Banks.LUMBRIDGE_UPPER.contains(myPosition());
}

private void withdrawFood() {
	status = "Withdrawing food";
	banker = npcs.closest("Banker");
	if (banker != null && banker.interact("Bank")) {
		// now sleep until the bank interface opens
		// hint: https://osbot.org/api/org/osbot/rs07/utility/ConditionalSleep.html
	}
}

private boolean shouldGoToCows() {
	return inventory.isFull();
}

private void goToCows() {
	status = "Going to the cows";
	getWalking().walk(cowTile);
}

private boolean shouldKillCows() {
	return inventory.contains("Salmon");
}

private void killCows() {
	status = "Killing cows";
	cow = npcs.closest("Cow"); // better filtering needed - you might attack a cow someone else is already attacking, or you might be fighting a cow and attempt to attack another cow in non-multi zone
	if (cow != null && cow.interact("Attack")) {
		// now sleep until you've killed the cow or are running low on health
		// hint: https://osbot.org/api/org/osbot/rs07/utility/ConditionalSleep.html
	}
}

 

 

Relax my dude, no need to be mad. People just made his script whatever it was intended to be, whether he used states or not. The point was to fix the code.

By the way 

private boolean shouldGoBank() {
	return inventory.isEmpty();
}

tl;dr

Why not just 

private boolean shouldBank = inventory.isEmpty();

 

2 minutes ago, luminlumin said:

 

Relax my dude, no need to be mad. People just made his script whatever it was intended to be, whether he used states or not. The point was to fix the code.

By the way 


private boolean shouldGoBank() {
	return inventory.isEmpty();
}

tl;dr

Why not just 


private boolean shouldBank = inventory.isEmpty();

 

Because that is a variable. If you set a variable, it'll never be updated unless you set it again. That's why we have functions. :)

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.