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.

Moving away from npc

Featured Replies

Hello! I was wondering if anyone could help with the following:

Say my player is less than 3 coordinates from an NPC, how would approach this situation so my bot will walk to a coordinate 3 tiles away (a reachable coordinate). 

        Area small = entity.getArea(2);
        Area big = entity.getArea(3);
        
        List<Position> positions = big.getPositions();        
        
        if(positions.removeAll(small.getPositions())) {
            Position position = positions.get(new Random().nextInt((positions.size() - 1)));
            if (position != null) {
                WalkingEvent event = new WalkingEvent(position);
                event.setMiniMapDistanceThreshold(0);
                event.setMinDistanceThreshold(0);
                event.setBreakCondition(new Condition() {
                    @Override
                    public boolean evaluate() {
                        return entity.getPosition().distance(myPosition()) >= 3;
                    }
                });
                execute(event);
            }
        }

? I think... ? I have a hunch I over complicated it

Edited by Isolate

40 minutes ago, Isolate said:

        Area small = entity.getArea(2);
        Area big = entity.getArea(3);
        
        List<Position> positions = big.getPositions();        
        
        if(positions.removeAll(small.getPositions())) {
            Position position = positions.get(new Random().nextInt((positions.size() - 1)));
            if (position != null) {
                WalkingEvent event = new WalkingEvent(position);
                event.setMiniMapDistanceThreshold(0);
                event.setMinDistanceThreshold(0);
                event.setBreakCondition(new Condition() {
                    @Override
                    public boolean evaluate() {
                        return entity.getPosition().distance(myPosition()) >= 3;
                    }
                });
                execute(event);
            }
        }

? I think... ? I have a hunch I over complicated it

It will fail if the position which was chosen at random is unreachable; in both WebWalkEvent or WalkingEvent.

 

WalkingEvent event = new WalkingEvent(Entity entity).setDistanceThreshold(1);
execute(event);

 

Create an account or sign in to comment

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.