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.

getPlayers closest player

Featured Replies

Hi guys,
I'm into scripting for 2 weeks now and ran into another problem now that I can't seem to solve. Thought I'd ask for help.

I'm trying to make a pker help where I would get all players attacking/surrounding him within 1 tile.

 

Spoiler

   public List<Player> getAttackers() {
        
        List<Player> friends = getPlayers().filter(p -> p != null && edgeArea.contains(p) && friendList.contains(p.getName())); 

        for (Player friend : friends) {
             friend.closest()..                         <<<<<------- this is where I cant get it to work :/ I see that there is no option for this in the API so I obviously can't do this here
        }


        return playersToBePjed;
    }

 

That's the snippet where I cant figure out a way to get the player object next to him

I appreciate all help

5 hours ago, Panason9c said:

Hi guys,
I'm into scripting for 2 weeks now and ran into another problem now that I can't seem to solve. Thought I'd ask for help.

I'm trying to make a pker help where I would get all players attacking/surrounding him within 1 tile.

private List<Player> getPlayersAttackingPlayer(String playerName, int tileDistanceFromPlayer, ArrayList<String> friendNames){
    Filter<Player> playerFilter = new Filter<Player>() {
        @Override
        public boolean match(Player player) {
            return !player.getName().equals(playerName) && myPlayer().getArea(tileDistanceFromPlayer).contains(player) && !friendNames.contains(player.getName())
                    && (player.getInteracting() != null) && player.getInteracting().getName().equals(playerName);
        }
    };
    return getPlayers().filter(playerFilter);
}

If you are just trying to get one player, use Malcoms method instead, this one will be more performant heavy.

Example Usage

ArrayList<String> friendsNames = new ArrayList<>();
friendsNames.add("Bill");

List<Player> players;

if((players = getPlayersAttackingPlayer(myPlayer().getName(), 20, friendsNames)) != null){
    for(Player player : players){
        log(player.getName());
    }
}

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.