H0rn Posted November 25, 2017 Share Posted November 25, 2017 Hey, so I was planning on making a farm purely based on my own knowledge but I have come across an issue that no matter what I try there's always issues, here's my method for checking for trees: RS2Object Yew = objects.closest(yew -> yew.exists() && yew.getName().equals("Yew") && yews.contains(yew)); But for some reason when it cuts down one tree it just hangs there until it re-spawns and doesn't try to go to the next nearest tree, here's my yew Area also: Area yews = new Area( new int[][]{ { 3266, 3472 }, { 3272, 3464 }, { 3307, 3461 }, { 3313, 3468 }, { 3309, 3474 }, { 3271, 3484 }, { 3270, 3496 }, { 3264, 3498 } } ); any tips in the right direction would be appreciated. Quote Link to comment Share on other sites More sharing options...
Explv Posted November 25, 2017 Share Posted November 25, 2017 2 minutes ago, H0rn said: Hey, so I was planning on making a farm purely based on my own knowledge but I have come across an issue that no matter what I try there's always issues, here's my method for checking for trees: RS2Object Yew = objects.closest(yew -> yew.exists() && yew.getName().equals("Yew") && yews.contains(yew)); But for some reason when it cuts down one tree it just hangs there until it re-spawns and doesn't try to go to the next nearest tree, here's my yew Area also: any tips in the right direction would be appreciated. Looking at your Area: It seems like the different Yew tree spawns are pretty far apart from each other. You *may* need to add your own code to say, "if there are no yew trees in my current spawn, walk to another yew tree spawn". That is assuming that there are no other issues with your code, which I cannot tell as you have only posted a small snippet. 1 Quote Link to comment Share on other sites More sharing options...
H0rn Posted November 25, 2017 Author Share Posted November 25, 2017 (edited) 3 minutes ago, Explv said: Looking at your Area: It seems like the different Yew tree spawns are pretty far apart from each other. You *may* need to add your own code to say, "if there are no yew trees in my current spawn, walk to another yew tree spawn". That is assuming that there are no other issues with your code, which I cannot tell as you have only posted a small snippet. I tried to keep it as simple as possible but do you recommend using more than one area? I also tried this: if (Yew.getPosition().distance(myPlayer()) > 5) { currentStatus = "Walking closer"; walking.walk(Yew.getArea(1)); } but it isn't very reliable and still hangs at the stump most of the time Edit: here's the full snippet: private void cutYews() throws InterruptedException { currentStatus = "Yews"; if (!yews.contains(myPlayer())) { currentStatus = "Walking to Yews"; walking.webWalk(yews); Sleep.sleepUntil(() -> yews.contains(myPlayer()),random(1200,3000)); } else { currentStatus = "Cutting Yews"; RS2Object Yew = objects.closest(yew -> yew.exists() && yew.getName().equals("Yew") && yews.contains(yew)); if (Yew != null && !myPlayer().isAnimating() && !myPlayer().isMoving()) { if (Yew.getPosition().distance(myPlayer()) > 5) { currentStatus = "Walking closer"; walking.walk(Yew.getArea(1)); } if (!Yew.isVisible()) { currentStatus = "Moving the camera"; camera.toEntity(Yew); } currentStatus = "Chop down"; Yew.interact("Chop down"); Sleep.sleepUntil(() -> !Yew.exists() || myPlayer().isMoving() || myPlayer().isAnimating(), random(2600,3000)); mouse.moveOutsideScreen(); } } } Edited November 25, 2017 by H0rn Quote Link to comment Share on other sites More sharing options...
Explv Posted November 25, 2017 Share Posted November 25, 2017 10 minutes ago, H0rn said: I tried to keep it as simple as possible but do you recommend using more than one area? Yes you will need to use more than one Area: You will need to implement some logic where if there is no tree in your current Area, walk to the next Area. 1 Quote Link to comment Share on other sites More sharing options...
H0rn Posted November 25, 2017 Author Share Posted November 25, 2017 2 minutes ago, Explv said: Yes you will need to use more than one Area: You will need to implement some logic where if there is no tree in your current Area, walk to the next Area. Awesome, super helpful thank you Explv Quote Link to comment Share on other sites More sharing options...
progamerz Posted November 25, 2017 Share Posted November 25, 2017 57 minutes ago, H0rn said: if (!Yew.isVisible()) { currentStatus = "Moving the camera"; camera.toEntity(Yew); } The default entity#interact always moves/walks to the entity whenever needed so this would be redundant. 1 Quote Link to comment Share on other sites More sharing options...
H0rn Posted November 25, 2017 Author Share Posted November 25, 2017 Just now, progamerz said: The default entity#interact always moves/walks to the entity whenever needed so this would be redundant. Oh really? Thanks for the heads up, I guess I'm just super paranoid at this stage then haha I overthink code when I'm writing 1 Quote Link to comment Share on other sites More sharing options...