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.

Begginer! Cow killer script gone wrong

Featured Replies


So basically ALL it does, kills a few cows, doesn`t pick up any cowhides and runs to bank, and back.

 

States:

private enum State {
		KILL, LOOT, WALK_TO_BANK, BANK, WALK_TO_KILL, WAIT
	};
	
	private State getState() {
		NPC cow = npcs.closest("Cow", "Cow calf");
		if (!myPlayer().isUnderAttack() && cow !=null && !myPlayer().isAnimating() && !cow.isUnderAttack())
			return State.KILL;
		GroundItem cowhide = groundItems.closest("Cowhide");
		if (!myPlayer().isUnderAttack() && cowhide !=null)
			return State.LOOT;
		if (inventory.isFull() && KILL_AREA.contains(myPlayer()))
			return State.WALK_TO_BANK;
		if (!inventory.isFull() && BANK_AREA.contains(myPlayer()))
			return State.WALK_TO_KILL;
		if (inventory.isFull() && BANK_AREA.contains(myPlayer()))
			return State.BANK;
		return State.WAIT;
	}

onLoop:

@Override
	public int onLoop() throws InterruptedException {
		if(myPlayer().getInteracting() != null) {
			return random(453, 999);
		}
		switch (getState()){
		case KILL:
			Player player = myPlayer();
			NPC cow = npcs.closest("Cow","Cow calf");
			if (!player.isUnderAttack() && (cow != null) && (cow.isAttackable()) && (!player.isMoving())) {
				cow.interact("Attack");
				return random(323, 532);
			} else {
				camera.toEntity(cow);
			}
			break;
		case LOOT:
			GroundItem cowhide = groundItems.closest("Cowhide");
			if(!inventory.isFull() && !myPlayer().isUnderAttack() && groundItems.equals(cowhide) && cowhide.isOnScreen()) {
				cowhide.interact("Take");
				return random(212, 326);
			} else {
				camera.toEntity(cowhide);
			}
		case WALK_TO_BANK:
			traversePath(path, false);
			sleep(random(1230,2452));
			break;
		case WALK_TO_KILL:
			traversePath(path, true);
			sleep(random(1343,2212));
			break;
		case WAIT:
			return random(121,212);
		case BANK:
			RS2Object bankBooth = objects.closest("Bank booth");
			if (bankBooth != null && bankBooth.isVisible()) {
				if (bankBooth.interact("Bank")) {
					while (!bank.isOpen())
						sleep(random(465, 863));
					bank.depositAll();
				}
			}
				break;
		}
		return random(243, 411);
	
	}

Doesnt work so no need for full source.

 

Can anybody give any tips?

Why not:

 

		if (inventory.isFull() && !BANK_AREA.contains(myPlayer()))
			return State.WALK_TO_BANK;
		if (!inventory.isFull() && !KILL_AREA.contains(myPlayer()))
			return State.WALK_TO_KILL;

??

 

  • Author

Thanks. ;P That fixed the wierd walking thing. Really nice support, thank you. My logic does not yet work. :D
Still not picking up hides, hmm, ima try find the reason.


Couldn`t the problem be? 

 

cowhide.interact("Take");

Is there a different option in API? 
Im really confused about the API, still, but will try to find.


just made the filter for the loot just to check for nulls and thats it.

if(cowhide != null) {
				cowhide.interact("Take");

A guy was picking up bones and beef, leaving only cowhidees on the ground and my script started to pick them up.

So the problem is it doesnt recognize cowhide when there is bones and beef on it. Wierd, huh?

 

make it just

GroundItem cowhide = groundItems.closest("Cowhide");
if(cowhide != null && !myPlayer.isUnderAttack()) {
   cowhide.interact("Take");
   sleep(1000);
}

Not sure is it 100% working as I'm writing it by hand without any spell checker

Edited by pitoluwa

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.