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.

List of entities

Featured Replies

groundItems.getAll() gets a list of all ground items

 

How do I do this for entites? I looked all over the api and I have found nothing :(

  • Author

Get all NPCs

Get all RS2Objects

Add both to a list

Done

how do i get all rs2objects? Thats what I need.

  • Author

script.getObjects().getAll();

this returns 7642 objects. Looping through all of them to find the ones near me takes a few seconds for some reason. Is there a reason for that?

this returns 7642 objects. Looping through all of them to find the ones near me takes a few seconds for some reason. Is there a reason for that?

 

Depends on how you are looping an what you are checking the objects for.

Edited by Botrepreneur

  • Author

Depends on how you are looping an what you are checking the objects for.

for(int i = 0; i < objects.getAll().size(); i++){
if(objects.getAll().get(i)!=null&&posDist(myPosition(),objects.getAll().get(i).getPosition())<5&&!objects.getAll().get(i).getName().equals("null"))
		//add to bigger list
}
for(int i = 0; i < objects.getAll().size(); i++){
if(objects.getAll().get(i)!=null&&posDist(myPosition(),objects.getAll().get(i).getPosition())<5&&!objects.getAll().get(i).getName().equals("null"))
		//add to bigger list
}

 

Every time you call objects.getAll() it will rescan for objects to create a new list.

That's why it's slow.

Call it once instead, save the list obtained and filter through that one list.

  • Author

Every time you call objects.getAll() it will rescan for objects to create a new list.

That's why it's slow.

Call it once instead, save the list obtained and filter through that one list.

Oh thanks I overlooked that :P

 

It took a few seconds because it was loading them 7000 times :P

Oh thanks I overlooked that tongue.png

 

It took a few seconds because it was loading them 7000 times tongue.png

 

When you are null checking or interacting with an item/object etc. you should always store it, and then interact with the stored object. Each time you call .get() it will get a new instance, and that instance could be not null, then when you go to interact with another .get() it can be null. If that makes sense. Although you may have already knew this and just forgot or not noticed it. ^_^

  • Author

When you are null checking or interacting with an item/object etc. you should always store it, and then interact with the stored object. Each time you call .get() it will get a new instance, and that instance could be not null, then when you go to interact with another .get() it can be null. If that makes sense. Although you may have already knew this and just forgot or not noticed it. happy.png

Yea I was just writing it too fast and forgot facep.gif

Guest
This topic is now closed to further replies.

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.