Jump to content

How To Search For Number Of Players Visible?


Mink

Recommended Posts

I feel so stupid asking this, but I've spent awhile searching through the forums for similar issues and tried figuring it out reading the api without any success.

How can I search for how many people are visible on my minimap? (does it include me?)

Please include required imports, thanks so much.

 

Also a small request: I feel a tutorial regarding navigating throughout the api effectively would be very beneficial for new users trying to learn to script. If someone finds spare time to create an informative thread about the api library I would greatly appreciate it.

 

Thanks for reading :D

Link to comment
Share on other sites

x = 0

 

For (Player p : all players) {

if (p is visible) {

add 1 to x

}

}

 

To get all players -> getPlayers().getAll() @ org.osbot.rs07.api.Players

Visibility check -> p.isVisible() (don't worry about the import it should come via the Players one)

 

Edit: this isn't for minimap visibility, an easy way to do that would be to iterate through all players and check for their distance (from you) instead of visibility smile.png

 

Edit 2: getPlayers().getAll() returns a list that does include your player, you can start x at -1 or subtract 1 after counting all players if you don't want the number to include you.

 

Hope this helps.

Edited by Botrepreneur
  • Like 2
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...