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.

Coloring map/minimap tiles of a certain area.

Featured Replies

Hello, I wanted to ask, how do I color map or minimap tiles of a certain area. I have an area defined by my players position with an integer added to it (area = myPlayer().getArea(size); ), and I want it to be displayed on the map or the minimap for lower cpu usage. so how would I do it?

Edited by Viliuks

My bad, @Bobrocket corrected me, but I found this

public Point minimapTranslate(Position pos) {
		//Get local position coordinates
		int x = pos.getX() - getMap().getBaseX();
		int y = pos.getY() - getMap().getBaseY();

		//Get the players current offset from the provided position
		//Using grid coordinates we get a more accurate result when we're in
		//the process of walking between two tiles.
		//1 tile = 2 units, in rX and rY
		int rX = (x * 4 + 2) - (myPlayer().getGridX() / 32);
		int rY = (y * 4 + 2) - (myPlayer().getGridY() / 32);

		//Get the current minimap position and camera rotation offsets.
		//these are often changing even without moving/rotating the camera.
		//^ This is probably to prevent autoclicking
		int offset = client.accessor.getMinimapX();
		int minimapAngle = client.accessor.getMinimapRotation();
		int angle = minimapAngle + offset & 0x7FF;

		//Calculates the sine and cosine vars to be used for rotation from the
		//minimap center. The minimap zoom is also random and often changing.
		//These are scaled up to improve accuracy in the following calculations
		int sin = (GraphicUtilities.CAMERA_SIN[angle] * 256) / (client.accessor.getMinimapZoom() + 256);
		int cos = (GraphicUtilities.CAMERA_COS[angle] * 256) / (client.accessor.getMinimapZoom() + 256);

		//Standard trigonometry; calculate the offset from minimap centre
		//Then downscale the result by right shift. We use 16 instead of 8 due to the unit of
		//rX and rY being doubled in comparison to real X,Y coords
		int mX = rY * sin + rX * cos >> 16;
		int mY = rY * cos - rX * sin >> 16;

		//Return the point. 644 and 80 are the minimap X, Y coordinates
		return new Point(644 + mX, 80 - mY);
	}

You can do

g.drawOval(minimapTranslate(position.get(i)).x -4, minimapTranslate(position.get(i)).y -2, 6, 6);

Edited by Woody

MiniMapTileDestination#getBoundingBox will return a rectangle, which you can use to paint

 

#getBoundingBox != drawing the actual rectangle.

Something like this should work:

<graphics 2D object>.drawShape(new Position(1, 2, 3).getPolygon(getBot()));

To draw an arbitrary area on the minimap you could do:

 

Area area = myPlayer().getArea(4);
Polygon p = new Polygon();
   for(int i = 0; i < area.getPolygon().npoints; i++) {
      short[] mm = GraphicUtilities.getMinimapScreenCoordinate(bot, area.getPolygon().xpoints[i], area.getPolygon().ypoints[i]);
      p.addPoint(mm[0], mm[1]);
   }
g.setColor(Color.RED);
g.draw(p);

 

  • Author

 

To draw an arbitrary area on the minimap you could do:

 

Area area = myPlayer().getArea(4);
Polygon p = new Polygon();
   for(int i = 0; i < area.getPolygon().npoints; i++) {
      short[] mm = GraphicUtilities.getMinimapScreenCoordinate(bot, area.getPolygon().xpoints[i], area.getPolygon().ypoints[i]);
      p.addPoint(mm[0], mm[1]);
   }
g.setColor(Color.RED);
g.draw(p);

Thanks, exactly what I needed.

 

To draw an arbitrary area on the minimap you could do:

 

Area area = myPlayer().getArea(4);
Polygon p = new Polygon();
   for(int i = 0; i < area.getPolygon().npoints; i++) {
      short[] mm = GraphicUtilities.getMinimapScreenCoordinate(bot, area.getPolygon().xpoints[i], area.getPolygon().ypoints[i]);
      p.addPoint(mm[0], mm[1]);
   }
g.setColor(Color.RED);
g.draw(p);

spoon-feeding.jpg

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.