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.

Smoking Rock Detection

Featured Replies

public boolean checkIfMiningSmokingRock() {
	if (myPlayer().isAnimating()) {
		RS2Object rock;
		Position myPosition = myPlayer().getPosition();
		switch (myPlayer().getRotation()) {
			case 0:       //SOUTH
				rock = getRockAtPosition(new Position(myPosition.getX(), myPosition.getY() - 1, 0));
				break;
			case 511:
			case 512:    //WEST
			case 513:
				rock = getRockAtPosition(new Position(myPosition.getX() - 1, myPosition.getY(), 0));
				break;
			case 1023:
			case 1024:    //NORTH
			case 1025:
				rock = getRockAtPosition(new Position(myPosition.getX(), myPosition.getY() + 1, 0));
				break;
			case 1535:
			case 1536:    //EAST
			case 1537:
				rock = getRockAtPosition(new Position(myPosition.getX() + 1, myPosition.getY(), 0));
				break;
		}
		return rock != null && !arrayContainsPrimitiveInt(MINABLE_ROCK_ID_ARRAY, rock.getId());    //method is not needed if the rock id's are stored in a list, #contains() would work fine
	}
	return false;
}

private RS2Object getRockAtPosition(Position position) {
	for (RS2Object current : client.getCurrentRegion().getObjects()) {
		if (current != null && current.getName().contains("Rock") && position.equals(current.getPosition())) {
			return current;
		}
	}
	return null;
}

private boolean arrayContainsPrimitiveInt(int[] array, int integer) {
	for (int current : array) {
		if (current == integer)
			return true;
	}
	return false;
}

FYI switch statement looks like that because when mining you're rotation isn't "exactly" what it's supposed to be and may be off by +- 1. This should give people a good idea on how to implement smoking rock detection into their own mining scripts.

Edited by Swizzbeat

thank you. Finally. Added it to my script, i'll be sure to credit.

Unsure of how to get it working, but at least i have somewhere to start now.

I've always just checked entity height.

 

public boolean isRockSmoking(RS2Object r) {
  boolean ret = false;
  if (r.getModel().getHeight() > 150) {
    // rock is smoking
    ret = true;
  }
  return ret;
}

Edited by dreamliner

public boolean checkIfMiningSmokingRock() {
	if (myPlayer().isAnimating()) {
		RS2Object rock;
		Position myPosition = myPlayer().getPosition();
		switch (myPlayer().getRotation()) {
			case 0:       //SOUTH
				rock = getRockAtPosition(new Position(myPosition.getX(), myPosition.getY() - 1, 0));
				break;
			case 511:
			case 512:    //WEST
			case 513:
				rock = getRockAtPosition(new Position(myPosition.getX() - 1, myPosition.getY(), 0));
				break;
			case 1023:
			case 1024:    //NORTH
			case 1025:
				rock = getRockAtPosition(new Position(myPosition.getX(), myPosition.getY() + 1, 0));
				break;
			case 1535:
			case 1536:    //EAST
			case 1537:
				rock = getRockAtPosition(new Position(myPosition.getX() + 1, myPosition.getY(), 0));
				break;
		}
		return rock != null && !arrayContainsPrimitiveInt(MINABLE_ROCK_ID_ARRAY, rock.getId());    //method is not needed if the rock id's are stored in a list, #contains() would work fine
	}
	return false;
}

private RS2Object getRockAtPosition(Position position) {
	for (RS2Object current : client.getCurrentRegion().getObjects()) {
		if (current != null && current.getName().contains("Rock") && position.equals(current.getPosition())) {
			return current;
		}
	}
	return null;
}

private boolean arrayContainsPrimitiveInt(int[] array, int integer) {
	for (int current : array) {
		if (current == integer)
			return true;
	}
	return false;
}

FYI switch statement looks like that because when mining you're rotation isn't "exactly" what it's supposed to be and may be off by +- 1. This should give people a good idea on how to implement smoking rock detection into their own mining scripts.

 

 

 

I implemented this, and changed the variables. What do i need to add into my loop to check if what it is mining is or isn't the rock?

 

public boolean checkIfMiningSmokingRock() {
	if (myPlayer().isAnimating()) {
		RS2Object rock;
		Position myPosition = myPlayer().getPosition();
		switch (myPlayer().getRotation()) {
			case 0:       //SOUTH
				rock = getRockAtPosition(new Position(myPosition.getX(), myPosition.getY() - 1, 0));
				break;
			case 511:
			case 512:    //WEST
			case 513:
				rock = getRockAtPosition(new Position(myPosition.getX() - 1, myPosition.getY(), 0));
				break;
			case 1023:
			case 1024:    //NORTH
			case 1025:
				rock = getRockAtPosition(new Position(myPosition.getX(), myPosition.getY() + 1, 0));
				break;
			case 1535:
			case 1536:    //EAST
			case 1537:
				rock = getRockAtPosition(new Position(myPosition.getX() + 1, myPosition.getY(), 0));
				break;
		}
		return rock != null && !arrayContainsPrimitiveInt(MINABLE_ROCK_ID_ARRAY, rock.getId());    //method is not needed if the rock id's are stored in a list, #contains() would work fine
	}
	return false;
}

private RS2Object getRockAtPosition(Position position) {
	for (RS2Object current : client.getCurrentRegion().getObjects()) {
		if (current != null && current.getName().contains("Rock") && position.equals(current.getPosition())) {
			return current;
		}
	}
	return null;
}

private boolean arrayContainsPrimitiveInt(int[] array, int integer) {
	for (int current : array) {
		if (current == integer)
			return true;
	}
	return false;
}

FYI switch statement looks like that because when mining you're rotation isn't "exactly" what it's supposed to be and may be off by +- 1. This should give people a good idea on how to implement smoking rock detection into their own mining scripts.

 

I've tried to implement this - have I implemented it right? tongue.png

public boolean checkIfMiningSmokingRock() {
		if (myPlayer().isAnimating()) {
			RS2Object vein = closestObject(MINE_AREA, GEM_ID);
			;
			Position myPosition = myPlayer().getPosition();
			switch (myPlayer().getRotation()) {
			case 0: // SOUTH
				vein = getRockAtPosition(new Position(myPosition.getX(),
						myPosition.getY() - 1, 0));
				break;
			case 511:
			case 512: // WEST
			case 513:
				vein = getRockAtPosition(new Position(myPosition.getX() - 1,
						myPosition.getY(), 0));
				break;
			case 1023:
			case 1024: // NORTH
			case 1025:
				vein = getRockAtPosition(new Position(myPosition.getX(),
						myPosition.getY() + 1, 0));
				break;
			case 1535:
			case 1536: // EAST
			case 1537:
				vein = getRockAtPosition(new Position(myPosition.getX() + 1,
						myPosition.getY(), 0));
				break;
			}
			return vein != null
					&& !arrayContainsPrimitiveInt(GEM_ID, vein.getId());

			// method is not needed if the rock id's are stored in a list,
			// #contains() would work fine - swizz
		}
		return false;
	}

	private RS2Object getRockAtPosition(Position position) {
		for (RS2Object current : client.getCurrentRegion().getObjects()) {
			if (current != null && current.getName().contains("Rock")
					&& position.equals(current.getPosition())) {
				return current;
			}
		}
		return null;
	}

	private boolean arrayContainsPrimitiveInt(int[] array, int integer) {
		for (int current : array) {
			if (current == integer)
				return true;
		}
		return false;
	}

	// onLoop()
	@Override
	public int onLoop() throws InterruptedException {
		if (hopIfCrashed == 1) {
			crashManager();
		}
		while (GUI.isVisible()) {
			sleep(200);
		}
		sleep(200);
		if (GUI.getGaDicht()) {
			stop();
		} else {
			hopForRocks = GUI.hopForRocks;
			hopIfCrashed = GUI.hopIfCrashed;
			powermine = GUI.powermine;
			consoleInfo = GUI.consoleInfo;
			Antiban = GUI.Antiban;
		}
		t = new Timer(0);
		idleTimer();
		switch (getState()) {
		case MINE:
			AntiBan();
			RS2Object vein = closestObject(MINE_AREA, GEM_ID);
			if (!myPlayer().isAnimating()) {
				if (vein != null)
					if (vein.interact("Mine")) {
						sleep(random(300, 600));
						checkIfMiningSmokingRock();
					}

			}

			if (equipmentTab.isWieldingWeaponThatContains("Broken pickaxe")) {
				status = "Broken Pickaxe";
				sleep(random(400, 600));
				logoutTab.logOut();
				if (consoleInfo == 1) {
					log("[APA Shilo Miner] Logged out - Reason: Broken Pickaxe.");
				}
				stop();
			}
			if (vein == null) {
				status = "Waiting for rock";
				if (hopForRocks == 1) {
					worldSwitcher();
				}
				if (Antiban == 1) {
					AntiBan();
				}
			}
			break;

Thanks for the help smile.png

EDIT: Dang, doesn't work. must have screwed something up somewhere ^.^

Edited by Apaec

As dreamliner said, I'm pretty sure you can just do this via model height.

Tried everything to do with model height too. I'm just clueless xD

  • Author

I've always just checked entity height.

 

public boolean isRockSmoking(RS2Object r) {
  boolean ret = false;
  if (r.getModel().getHeight() > 150) {
    // rock is smoking
    ret = true;
  }
  return ret;
}

 

As dreamliner said, I'm pretty sure you can just do this via model height.

Hmm I never even thought of height, thanks. 

  • 3 months later...
  • Author

Is a smoking rock not an npc? Sorry I have not made a miner before tongue.png

Nope. Literally nothing changes about the object besides the height and ID which is why there's so many people asking about smoking rock detection :p

Nope. Literally nothing changes about the object besides the height and ID which is why there's so many people asking about smoking rock detection tongue.png

 

Oh rofl. And the smoking rock doesnt animate either?

Guest
This topic is now closed to further replies.

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.