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 to click local players around you?

Featured Replies

So I've managed to get the players around me and get their index #. But how do I right click the players around me, using the index # that I just collected?

if(getPlayers().getAll() != null) {
	List<Player> p = getPlayers().getAll();
	int j = p.get(0).getIndex();
	log(j);
}

Random rand = new Random();
        if(getPlayers().getAll() != null) {
            java.util.List<Player> p = getPlayers().getAll();
            int randomNum = rand.nextInt(((p.size()-1) - 0) + 1) + 0;
            Player randomPlayer = p.get(randomNum);
            if(randomPlayer != null){
                randomPlayer.hover();
            }

        }

you could try something like this to get a random one, i dont know how accurate my random function is... i'm not good at it

instead of hover you could do whatever you wanted, like right click on him or whatever

 

  • Author
Random rand = new Random();
        if(getPlayers().getAll() != null) {
            java.util.List<Player> p = getPlayers().getAll();
            int randomNum = rand.nextInt(((p.size()-1) - 0) + 1) + 0;
            Player randomPlayer = p.get(randomNum);
            if(randomPlayer != null){
                randomPlayer.hover();
            }

        }

you could try something like this to get a random one, i dont know how accurate my random function is... i'm not good at it

instead of hover you could do whatever you wanted, like right click on him or whatever

 

 

 

Ahh thank you very much!

 

So I've managed to get the players around me and get their index #. But how do I right click the players around me, using the index # that I just collected?


 

 


java.util.List<Player> p = getPlayers().getAll();
        if(p != null) {
            int randomNum = script.random(0, p.size()-1);
            Player randomPlayer = p.get(randomNum);
            if(randomPlayer != null){
                randomPlayer.hover();
            }
        }

you could try something like this to get a random one, i dont know how accurate my random function is... i'm not good at it

instead of hover you could do whatever you wanted, like right click on him or whatever

 

 

 

First you need to store the list, then null check the list. Making 2 calls is a common beginner mistake, which can result in a NPE when you thought you checked it. 

See the quote for the changed code. 

 

Also idk where u got this from:

int randomNum = rand.nextInt(((p.size()-1) - 0) + 1) + 0;

 

but that literally makes no sense.

 

This is the same as p.size()

 

-1 - 0 + 1 + 0 = 0

No clue what you were on when you wrote that but i need some. 

First you need to store the list, then null check the list. Making 2 calls is a common beginner mistake, which can result in a NPE when you thought you checked it. 

See the quote for the changed code. 

 

Also idk where u got this from:

int randomNum = rand.nextInt(((p.size()-1) - 0) + 1) + 0;

 

but that literally makes no sense.

 

This is the same as p.size()

 

-1 - 0 + 1 + 0 = 0

No clue what you were on when you wrote that but i need some. 

Last few days i've been pretty out of it.

Didn't think it looked right at all, dunno why i bothere + or - 0's but ay i did :P

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.