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.

Get bounding tiles of Area

Featured Replies

I've tried all sorts of different way to get this. What I'm look for is the outside tiles of an Area or Position[]

 

I hate to ask on here, but I really could use this help if anyone has any input. Thank you ahead of time.

Edited by Polymorphism

would be easy to do this with a rectangular area, but you'd need a little bit of work with a poly area.

This was something that I quickly wrote out, but the idea is there.  Would be interested to see other peoples' solvencies. 

might do something like this:

 

class Rectanglarea extends Area {

      private final int x1, y1, x2, y2; 

      public Rectanglarea(int x1, int y1, int x2, int y2) {

          super(x1, y1, x2, y2);

          this.x1 = x1;

          this.x2 = x2;

          this.y1 = y1;

          this.y2 = y2;     

     }

     public List<Position> getOuterPositions() {

            List<Position> outerPositions = new ArrayList<>();

            for(int y = y1; y <= y2; y++) {

                  outerPositions.add(new Position(x1, y, getZ()));

                  outerPositions.add(new Position(x2, y, getZ()));

          }

          for(int x = x1; x <= x2; x++) {

               outerPositions.add(new Position(x, y1, getZ()));

               outerPositions.add(new Position(x, y2, getZ()));

          }

          return outerPositions;

    }

}

  • Author
12 minutes ago, Imateamcape said:

would be easy to do this with a rectangular area, but you'd need a little bit of work with a poly area.

This was something that I quickly wrote out, but the idea is there.  Would be interested to see other peoples' solvencies. 

might do something like this:

 

class Rectanglarea extends Area {

      private final int x1, y1, x2, y2; 

      public Rectanglarea(int x1, int y1, int x2, int y2) {

          super(x1, y1, x2, y2);

          this.x1 = x1;

          this.x2 = x2;

          this.y1 = y1;

          this.y2 = y2;     

     }

     public List<Position> getOuterPositions() {

            List<Position> outerPositions = new ArrayList<>();

            for(int y = y1; y <= y2; y++) {

                  outerPositions.add(new Position(x1, y, getZ()));

                  outerPositions.add(new Position(x2, y, getZ()));

          }

          for(int x = x1; x <= x2; x++) {

               outerPositions.add(new Position(x, y1, getZ()));

               outerPositions.add(new Position(x, y2, getZ()));

          }

          return outerPositions;

    }

}

 

Yeah, mine is a variable Polygon area which is dynamically generated based on player position and settings. That's where my issue comes into play. 

  • Author

For my situation this worked, but still looking for something that is universal for Polygon Area.

 

		safeArea = new Area(new Position(sX - is.maxDistance, sY - is.maxDistance, sZ),
				new Position(sX + is.maxDistance, sY + is.maxDistance, sZ));

		safeTiles = safeArea.getPositions();
		bounding = new Position[safeTiles.size()];
		for (int i = 0; i < safeTiles.size(); i++) {
			if (safeTiles.get(i).distance(startPosition) == is.maxDistance)
				bounding[i] = safeTiles.get(i);
		}

 

13 minutes ago, Polymorphism said:

For my situation this worked, but still looking for something that is universal for Polygon Area.

 


		safeArea = new Area(new Position(sX - is.maxDistance, sY - is.maxDistance, sZ),
				new Position(sX + is.maxDistance, sY + is.maxDistance, sZ));

		safeTiles = safeArea.getPositions();
		bounding = new Position[safeTiles.size()];
		for (int i = 0; i < safeTiles.size(); i++) {
			if (safeTiles.get(i).distance(startPosition) == is.maxDistance)
				bounding[i] = safeTiles.get(i);
		}

 

well whats the scenario where you need to get the bounding tiles? there might be a more efficient way around creating this code

  • Author
11 hours ago, Imateamcape said:

well whats the scenario where you need to get the bounding tiles? there might be a more efficient way around creating this code

 

In my case it's simply for drawing the outside of an area vs all tiles of the area. My script uses a max travel distance , so in my case all i gotta do is draw tiles that are so far away. But this will be a bit different if the radius (circles I know, but relative enough) is unknown

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.