Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Move to next tree in a wide area?

Featured Replies

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.

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:

669d3f9b9cd6a34c3f2fb5bf6648bc16.png

 

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.

  • Author
3 minutes ago, Explv said:

 

Looking at your Area:

669d3f9b9cd6a34c3f2fb5bf6648bc16.png

 

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 by H0rn

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:

81143e863ca8cf5ebab80f740481bb95.png

You will need to implement some logic where if there is no tree in your current Area, walk to the next Area.

 

  • Author
2 minutes ago, Explv said:

Yes you will need to use more than one Area:

81143e863ca8cf5ebab80f740481bb95.png

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 <3 thank you Explv 

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.

  • Author
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 :(

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.