Skip 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.

GraphicUtilities#getMinimapScreenCoordinate(Bot, int, int) = 0, 0

Featured Replies

2mxg7y0.png

 

  • First picture: Sorceress Garden lobby is entirely visible on the minimap.
  • Second picture: Sorceress Garden lobby's northwest point is not visible on the minimap.

As you can see, if the point isn't visible on the minimap, the short[] returns as {0, 0}. Can you please fix this? The point shouldn't have to be visible on the minimap for it to be drawable on the screen where it would be on the minimap. This is quite annoying when drawing path arrays.

 

I have used jelknab's method to draw paths (http://osbot.org/forum/topic/8566-getting-positions-on-your-screen/?hl=minimap), but it doesn't accurately calculate the point on the minimap. So I combined the two methods (OSBot's API default and Jelknabs) whereby the OSBot's method is called if the minimap point is visible, otherwise Jelknab's method is called. The path rendering is wonky.

  • Developer

i was having some issues to with this... Tried to print out whoel paths or some kind of web.

It returns 0,0 if it's not visible at the minimap... Always bin like this sad.png

 

Even though I'm sure there better ways then osbot uses at the moment.

Saw other clients/pll drawing whole paths/ maps on the minimap smile.png

 

@Devs

Can this be changed so EVERY tile can be converted to the minimap?

Edited by Khaleesi

oh this will be awesome. Dev please do this.

 

ps. divine util only works on the main screen. I wanted to add minimap support. So please do this devs

not sure if this will help. but i draw using new MinimapDestinaton(Bot bot, Position position); then get the coordinates from that?

  • Author

not sure if this will help. but i draw using new MinimapDestinaton(Bot bot, Position position); then get the coordinates from that?

 

That might help actually. But I prefer the short[] for the X and Y. :)

It'd have to be done in a way that doesn't prevent isOnMinimap methods to function properly to identify "Clickable" minimap points, though.

 

This should work for your needs:

	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);
	}

Edited by FrostBug

  • Author

It'd have to be done in a way that doesn't prevent isOnMinimap methods to function properly to identify "Clickable" minimap points, though.

 

This should work for your needs:

	public Point minimapTranslate(Position pos) {
		int x = pos.getX() - getMap().getBaseX();
		int y = pos.getY() - getMap().getBaseY();
		int rX = (x * 4 + 2) - myPlayer().getGridX() / 32;
		int rY = (y * 4 + 2) - myPlayer().getGridY() / 32;
		
		int offset = client.accessor.getMinimapX();
		int minimapAngle = client.accessor.getMinimapRotation();
		int angle = minimapAngle + offset & 0x7FF;

		int sin = (GraphicUtilities.CAMERA_SIN[angle] * 256) / (client.accessor.getMinimapZoom() + 256);
		int cos = (GraphicUtilities.CAMERA_COS[angle] * 256) / (client.accessor.getMinimapZoom() + 256);
		int mX = rY * sin + rX * cos >> 16;
		int mY = rY * cos - rX * sin >> 16;
		return new Point(644 + mX, 80 - mY);
	}

God damn, Frost, I wish I was that good at maths. >.< I'm barely able to grasp this code. Could you comment it please? I'd love to understand it fully. <3:)

  • Author

It'd have to be done in a way that doesn't prevent isOnMinimap methods to function properly to identify "Clickable" minimap points, though.

 

This should work for your needs:

	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 its tile.
                //This will be 0, 0 if the player is standing still
                //or positive/negative if the player is currently moving between tiles
		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 random and often changing. They are a measure jagex put in to prevent
                //certain forms of auto-clicking, by slowly changing the rotation/offsets.
		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
		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);
	}

 

Thanks! The commenting definitely helps (even though I'm not 100% grasping it yet lol). Your code works like an absolute charm!

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

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.