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.

getting position

Featured Replies

mouse.getPosition() unless that's not what you wanted.

   

Unless this gets the x/y of where the mouse is on the osbot client and not what's under the mouse, but I was under the impression that this gets the in game cords.

Edited by twin 763


public Position getPositionUnderMouse(Point mousePosition) {

for(int x = 0; x < 104; x++) {

for(int y = 0; y < 104; y++) {

Position pos = new Position(getMap().getBaseX()+x, getMap().getBaseY()+y, getMap().getPlane());

if(pos.isVisible(getBot()) && pos.getPolygon(getBot()).contains(mousePosition)) {

return pos;

}

}

}

return null;

}

Edited by Soldtodie

	public Position getPositionUnderMouse(Point mousePosition) {
		
		for(int x = 0; x < 104; x++) {
			for(int y = 0; y < 104; y++) {
				Position pos = new Position(getMap().getBaseX()+x, getMap().getBaseY()+y, getMap().getPlane());
				if(pos.isVisible(getBot()) && pos.getPolygon(getBot()).contains(mousePosition)) {
					return pos;
				}
			}
		}
		
		return null;
	}

don't check all the tiles in the region, just get the tiles around the local player and check them (iirc the landscape only draws max 25 tiles from the cameras location)

don't check all the tiles in the region, just get the tiles around the local player and check them (iirc the landscape only draws max 25 tiles from the cameras location)

 

When you want to get a position that is not loaded.

	public Position getPositionUnderMouse(Point mousePosition) {
		
		for(int x = 0; x < 104; x++) {
			for(int y = 0; y < 104; y++) {
				Position pos = new Position(getMap().getBaseX()+x, getMap().getBaseY()+y, getMap().getPlane());
				if(pos.isVisible(getBot()) && pos.getPolygon(getBot()).contains(mousePosition)) {
					return pos;
				}
			}
		}
		
		return null;
	}

 

If you use this, make sure you only call this method when clicking.

Not the kind of method you want to call every couple of ms.

When you want to get a position that is not loaded.

but your mouse can't be over a tile that isn't on camera.

  • Author
	public Position getPositionUnderMouse(Point mousePosition) {
		
		for(int x = 0; x < 104; x++) {
			for(int y = 0; y < 104; y++) {
				Position pos = new Position(getMap().getBaseX()+x, getMap().getBaseY()+y, getMap().getPlane());
				if(pos.isVisible(getBot()) && pos.getPolygon(getBot()).contains(mousePosition)) {
					return pos;
				}
			}
		}
		
		return null;
	}

thanks for this you gave me the idea.

 

don't check all the tiles in the region, just get the tiles around the local player and check them (iirc the landscape only draws max 25 tiles from the cameras location)

thats exactly what im going to do. Thanks for the info

 

If you use this, make sure you only call this method when clicking.

Not the kind of method you want to call every couple of ms.

i want it to be like the hover  debug where it still me the current tile.

 

Entity hover debug i think

i want the api version

 

mouse.getPosition() unless that's not what you wanted.

   

Unless this gets the x/y of where the mouse is on the osbot client and not what's under the mouse, but I was under the impression that this gets the in game cords.

that returns a point the x and y of the mouse position

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.