Swizzbeat Posted April 13, 2014 Share 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 Link to comment Share on other sites More sharing options...
Jack Posted April 13, 2014 Share Posted April 13, 2014 will save for future Link to comment Share on other sites More sharing options...
Novak Posted April 13, 2014 Share Posted April 13, 2014 ty jizzyswizzybusy Link to comment Share on other sites More sharing options...
Guest Apogee Posted April 13, 2014 Share 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. Link to comment Share on other sites More sharing options...
Dreamliner Posted April 13, 2014 Share 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 Link to comment Share on other sites More sharing options...
Guest Apogee Posted April 13, 2014 Share 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? Link to comment Share on other sites More sharing options...
Botre Posted April 13, 2014 Share Posted April 13, 2014 (edited) NVM Edited April 13, 2014 by Botrepreneur Link to comment Share on other sites More sharing options...
Apaec Posted April 13, 2014 Share 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 Link to comment Share on other sites More sharing options...
Pseudo Posted April 13, 2014 Share Posted April 13, 2014 As dreamliner said, I'm pretty sure you can just do this via model height. Link to comment Share on other sites More sharing options...
Apaec Posted April 13, 2014 Share 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 Link to comment Share on other sites More sharing options...
Swizzbeat Posted April 13, 2014 Author Share 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. Link to comment Share on other sites More sharing options...
Mysteryy Posted July 17, 2014 Share 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 Link to comment Share on other sites More sharing options...
Swizzbeat Posted July 17, 2014 Author Share 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 Link to comment Share on other sites More sharing options...
Mysteryy Posted July 17, 2014 Share 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? Link to comment Share on other sites More sharing options...
Swizzbeat Posted July 17, 2014 Author Share Posted July 17, 2014 Oh rofl. And the smoking rock doesnt animate either? Unless they updated it recently nope. Link to comment Share on other sites More sharing options...