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.

Position problems

Featured Replies

Hello everyone, I'm working on a script and I have to go from place A to B because the 2 places are not far from each other and therefore I want to use "walkingEvents".
There is a gate between those two places. My script goes to the place in front of the gate, but I can not get him to open the gate.
Could someone look at my code and tell me what I'm doing wrong?
Still learning the basics so it can be a stupid mistake :)
Thanks in advance.

Spoiler

if (myPlayer().getPosition() == new Position( 3110,9518,0)){
                Entity secondGate = objects.closest(9719);
                secondGate.interact("Open");
            } else if (myPlayer().getPosition() == new Position(3111,9511,0)){
                walkAndTalk();
            } else {
                WalkingEvent event = new WalkingEvent(new Position(3110,9518,0));
                event.setMinDistanceThreshold(0);
                execute(event);
            }

 

 

 

If you know where you're going to and where you're coming from, then i'd suggest using paths to walk the distance. Also, rather than using exact positions, you might find areas useful, or even better would be to use reachability checks so that your code is less specific.

Good luck :)

Apa

Edited by Apaec

Quote

myPlayer().getPosition() == new Position( 3110,9518,0)

The "==" operator tests if two references refer to the same object in memory. Since you just created a new Position with the 'new' keyword, they can never be the same object in memory, even if they hold the same coordinates. What you're looking for here is the equals method, which in the Position class is overridden to test coordinate equality.

Though ideally you shouldn't have to rely on specific absolute coordinates.

Edited by FrostBug

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.