Jump to content

Smoking/Bubbling/Exploding Rock detection


Apaec

Recommended Posts

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 by Apaec
Link to comment
Share on other sites

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:

 

80CgK.png

 

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

Nice happy.png 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:

 

80CgK.png

 

This will essentially just get a random coordinate each time which is valid for that area and walk to it happy.png

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

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

  • Like 1
Link to comment
Share on other sites

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

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

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

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...