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.

How do I check if my player is in a certain Position, not Area?

Featured Replies

Like I'm on the 3rd floor of a place; the area coordinates only check ground floor, but I need to make sure he's in that third floor before continuing. :D

You can define a area with z = 3

Doing this ; new Area(new Position(x y z), new Position(x y z))

OR

Position t = new position(x y z)

Or tile t im not sure, not at home

if (myPlayer().getPosition() == t){

\\something

}

  • Author

You can define a area with z = 3

Doing this ; new Area(new Position(x y z), new Position(x y z))

OR

Position t = new position(x y z)

Or tile t im not sure, not at home

if (myPlayer().getPosition() == t){

\\something

}

 

Ohh forreal?? That helps a ton. Thanks man!

 

Area AREA = new Area(x1, y1, x2, y2).setPlane(z);

 

Totally missed this post, thanks appreciate it!!

If you're checking a specific Position, don't use Area and don't compare objects using "==". Keep it simple:
 

Position myPos = myPosition();
Position targetPos = new Position(1000, 1000, 3);

if (myPos.equals(targetPos)) {
	// You're at position
} else {
	// You're not at position
}

Edit: After reading your first post, you can simply do this:

Position myPos = myPosition();
if (someArea.contains(myPos) && myPos.getZ() == 3) {
	// You're in an area AND on the 3rd floor
} else {
	// You're not...
}

You can set a plane for the Area, but that's only useful if the Area location is unique to whichever plane you're checking. For instance, if I'm in Lumbridge Castle, my Area will cover the entire castle and I will check the plane using my character's Z value, instead of setting the plane of the Area. Otherwise, I will have to constantly set that value to check what floor I'm on, which is just terrible.

 

Example of how I would handle Lumbridge Castle's many floors to spin flax:

Position myPos = myPosition();
if (lumbridgeCastle.contains(myPos)) {
	switch(myPos.getZ()) {
	case 0:
		// Ground floor
		// Climb staircase UP
	break;
	case 1:
		// First floor
		// Use spinning wheel, or go bank
		// upstairs 
	break;
	case 2:
		// Second floor
		// Withdraw flax, or go to
		// spinning wheel downstairs
	break;
	}
}

Edited by liverare

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.