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.

Finding player orientation

Featured Replies

 

This method finds what direction the player is facing based on the previous tile, and assigns it to the 'direction' string.

    private void checkPlayerDirection() {
        int currentX = myPlayer().getX();
        int currentY = myPlayer().getY();
        int deltaX = currentX - previousX;
        int deltaY = currentY - previousY;

        if (deltaX == 0 && deltaY == 0) {
            direction = previousDirection; // Use the previous direction when not moving
        } else if (deltaX == 0) {
            direction = deltaY > 0 ? "North" : "South";
        } else if (deltaY == 0) {
            direction = deltaX > 0 ? "East" : "West";
        } else if (deltaX > 0) {
            direction = deltaY > 0 ? "North-East" : "South-East";
        } else {
            direction = deltaY > 0 ? "North-West" : "South-West";
        }

        if (!direction.equals(previousDirection)) {
            log("Player is facing: " + direction);
            previousDirection = direction;
        }
    }

 

onStart

        previousX = myPlayer().getX();
        previousY = myPlayer().getY();

 

onLoop

	checkPlayerDirection();
        previousX = myPlayer().getX();
        previousY = myPlayer().getY();

 

Variables

    int previousX;
    int previousY;
    String direction;
    String previousDirection;

 

Usage

if(direction == "North") {
        	//do something
        }

Screenshot_4.png

Edited by xlDino

You can simply check the rotation of a player, might be easier than checking it like that :D

myPlayer().getRotation()


If you enable myPlayer debug in the debug tab, it will be included. :)
If interacting with an entity these values sometimes shift a little bit.

0 = South
256 = South-West
512 = West
768 = North-West
1024 = North
1280 = North-East
1536 = East
1792 = South-East
HHUflGS.png

Edited by Khaleesi

  • Author
2 hours ago, Khaleesi said:

You can simply check the rotation of a player, might be easier than checking it like that :D

myPlayer().getRotation()


If you enable myPlayer debug in the debug tab, it will be included. :)
If interacting with an entity these values sometimes shift a little bit.

0 = South
256 = South-West
512 = West
768 = North-West
1024 = North
1280 = North-East
1536 = East
1792 = South-East
HHUflGS.png

Found this out after hahahahaha

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.