Swizzbeat Posted April 13, 2014 Posted April 13, 2014 (edited) 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 April 13, 2014 by Swizzbeat 1
Guest Apogee Posted April 13, 2014 Posted April 13, 2014 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.
Dreamliner Posted April 13, 2014 Posted April 13, 2014 (edited) 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 April 13, 2014 by dreamliner 4
Guest Apogee Posted April 13, 2014 Posted April 13, 2014 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?
Apaec Posted April 13, 2014 Posted April 13, 2014 (edited) 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? 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 EDIT: Dang, doesn't work. must have screwed something up somewhere ^.^ Edited April 13, 2014 by Apaec
Pseudo Posted April 13, 2014 Posted April 13, 2014 As dreamliner said, I'm pretty sure you can just do this via model height.
Apaec Posted April 13, 2014 Posted April 13, 2014 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
Swizzbeat Posted April 13, 2014 Author Posted April 13, 2014 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.
Mysteryy Posted July 17, 2014 Posted July 17, 2014 Hmm I never even thought of height, thanks. Is a smoking rock not an npc? Sorry I have not made a miner before :P
Swizzbeat Posted July 17, 2014 Author Posted July 17, 2014 Is a smoking rock not an npc? Sorry I have not made a miner before 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
Mysteryy Posted July 17, 2014 Posted July 17, 2014 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 Oh rofl. And the smoking rock doesnt animate either?
Swizzbeat Posted July 17, 2014 Author Posted July 17, 2014 Oh rofl. And the smoking rock doesnt animate either? Unless they updated it recently nope.