Apaec Posted April 8, 2014 Share Posted April 8, 2014 (edited) So, after working on making a mining script I stumbled upon the problem of bubbling rocks. As I couldn't find a clear description on how to solve this problem, I created a solution for myself. After testing it as part of my script, I saw it work. It works on the basis that smoking rocks have a larger height in comparison to normal rocks. Here is the code in context: public int onLoop() throws InterruptedException { switch (getState()) { case MINE: if (!myPlayer().isAnimating()) {// IF PLAYER IS NOT ANIMATING // (MINING) RS2Object vein = closestObject(TRIPLE_ROCK_AREA, IRON_ID); if (vein != null) if (TRIPLE_ROCK_AREA.contains(myPlayer())) { if (vein.interact("Mine")) sleep(random(600, 1850)); } else { // IF PLAYER IS ANIMATING (MINING) if (!(vein.getModel().getHeight() < 80)) walk(TRIPLE_ROCK_AREA); //Walk away from Bubbling Rock } if (client.getMyPlayer().isAnimating()) { AntiBan(); } } So to avoid the rock I have made the script walk to an area (defined as TRIPLE_ROCK_AREA) which ensures that it doesn't mine the rock. if (!myPlayer().isAnimating()) {// IF PLAYER IS NOT ANIMATING (Mining) // (MINING) RS2Object vein = closestObject(TRIPLE_ROCK_AREA, IRON_ID); if (vein != null) if (TRIPLE_ROCK_AREA.contains(myPlayer())) { if (vein.interact("Mine")) sleep(random(600, 1850)); } else { // IF PLAYER IS ANIMATING (MINING) if (!(vein.getModel().getHeight() < 80))//Decides whether rock is Bubbling or not. walk(TRIPLE_ROCK_AREA); //Walk away from Bubbling Rock Let me know if you have any further questions. *EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT SCRIPT DOESN'T WORK! We need a solution to this problem in the snippets directory. Anyone got any further ideas of how to detect for smoking rocks? Edited April 8, 2014 by Apaec Link to comment Share on other sites More sharing options...
Extreme Scripts Posted April 8, 2014 Share Posted April 8, 2014 Nice ^_^ always nice to see new people trying to script. Just a suggestion to make it look less bot like, instead of walking to the same position in the area each time you could just define one huge ass area and grab a random position each time for it to walk to: This will essentially just get a random coordinate each time which is valid for that area and walk to it ^_^ Link to comment Share on other sites More sharing options...
Apaec Posted April 8, 2014 Author Share Posted April 8, 2014 Nice always nice to see new people trying to script. Just a suggestion to make it look less bot like, instead of walking to the same position in the area each time you could just define one huge ass area and grab a random position each time for it to walk to: This will essentially just get a random coordinate each time which is valid for that area and walk to it Thanks for the help! Would it be possible to add you on skype to discuss this? >.> i started coding yesterday lol. Also i'm a bit annoyed because the smoking rock detection doesn't seem to work. I saw it work once, posted this, then just watched it break my pick :c Link to comment Share on other sites More sharing options...
Swizzbeat Posted April 8, 2014 Share Posted April 8, 2014 This won't work. You have to write a getInteracting method to check the height of what you're interacting with. Link to comment Share on other sites More sharing options...
Nezz Posted April 8, 2014 Share Posted April 8, 2014 This won't work. You have to write a getInteracting method to check the height of what you're interacting with. Or make "vein" a global variable. Check for smoking rock detection outside of if(!myPlayer().isAnimating()) so if(!animating) vein = closestobject mine stuff else if(vein.getHeight() > 80) smoking rock 1 Link to comment Share on other sites More sharing options...
Swizzbeat Posted April 8, 2014 Share Posted April 8, 2014 Or make "vein" a global variable. Check for smoking rock detection outside of if(!myPlayer().isAnimating()) so if(!animating) vein = closestobject mine stuff else if(vein.getHeight() > 80) smoking rock The ID changes as well, so trying to grab the closest rock for that ID would return null or a new rock completely if a surrounding rock shares the same ID. Link to comment Share on other sites More sharing options...
Merccy Posted April 8, 2014 Share Posted April 8, 2014 What I would do is when you start mining the vein then save the height of that vein model in a variable (and the vein aswell). If you store those things you can check if the height got bigger. if (currentVein.getModel().getHeight() > normalHeight) { // Smoking rock } Link to comment Share on other sites More sharing options...
Nezz Posted April 8, 2014 Share Posted April 8, 2014 Okay so then here's what I'm thinking get the direction your player is facing get all objects around you find the object that's position is yours + 1 of whatever direction you're facing (or -1) get height of said object if height > whatever, smoking rock but you still have to do this outside of your if(!animating) Link to comment Share on other sites More sharing options...
Isolate Posted April 10, 2014 Share Posted April 10, 2014 So, after working on making a mining script I stumbled upon the problem of bubbling rocks. As I couldn't find a clear description on how to solve this problem, I created a solution for myself. After testing it as part of my script, I saw it work. It works on the basis that smoking rocks have a larger height in comparison to normal rocks. Here is the code in context: public int onLoop() throws InterruptedException { switch (getState()) { case MINE: if (!myPlayer().isAnimating()) {// IF PLAYER IS NOT ANIMATING // (MINING) RS2Object vein = closestObject(TRIPLE_ROCK_AREA, IRON_ID); if (vein != null) if (TRIPLE_ROCK_AREA.contains(myPlayer())) { if (vein.interact("Mine")) sleep(random(600, 1850)); } else { // IF PLAYER IS ANIMATING (MINING) if (!(vein.getModel().getHeight() < 80)) walk(TRIPLE_ROCK_AREA); //Walk away from Bubbling Rock } if (client.getMyPlayer().isAnimating()) { AntiBan(); } } So to avoid the rock I have made the script walk to an area (defined as TRIPLE_ROCK_AREA) which ensures that it doesn't mine the rock. if (!myPlayer().isAnimating()) {// IF PLAYER IS NOT ANIMATING (Mining) // (MINING) RS2Object vein = closestObject(TRIPLE_ROCK_AREA, IRON_ID); if (vein != null) if (TRIPLE_ROCK_AREA.contains(myPlayer())) { if (vein.interact("Mine")) sleep(random(600, 1850)); } else { // IF PLAYER IS ANIMATING (MINING) if (!(vein.getModel().getHeight() < 80))//Decides whether rock is Bubbling or not. walk(TRIPLE_ROCK_AREA); //Walk away from Bubbling Rock Let me know if you have any further questions. *EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT*EDIT SCRIPT DOESN'T WORK! We need a solution to this problem in the snippets directory. Anyone got any further ideas of how to detect for smoking rocks? Get triangle dimentions, i think the general rock is 90-99 but when its smoking/bubbling it becomes 100+ Link to comment Share on other sites More sharing options...