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.

[Guide]Types of Entities and how to use them correctly

Featured Replies

RuneScape has multiple entity types

NPC's

Objects

GroundItems

 

Determining which one to use is way simpler than people think.

NPC's will have yellow name tags in game

2xcst7n.png

Objects will have blue name tags in game

1rCljtX.png

GroundItems will have orange name tags in game

BOQ56Cg.png

 

Now when it comes to declaring variables what should we use?

For NPC's we would use the NPC class. Our code should look like this

NPC npc = ...

For Objects we would use the RS2Object class. Our Code should look like this

RS2Object object = ...

For GroundItems we would use the GroundItem class. Our code should look like this

GroundItem item = ...

Why would we shy away from using Entity class to define any entity from the game?

Well simply put Entity is just an interface and it might not contain things needed to any specific Entity implementing classes.

Like RS2Object will have getType() method but Entity will not.

 

The main place to use Entity class is when we are passing it to a parameter of a method and making your own lets say interacting methods.

We would use Entity in our parameter to make it accept any Entity type.

public void interactCustom(Entity entity, String action){
    if(entity.isVisible())
        entity.interact(action);
    else
        getCamera().toEntity(entity);
}

Of course again there will come limitations, which are when you are making a method for getting the type of an Object and logging it.

 

Having our code look like this will not work and give us an error.

public void getTypeAndLog(Entity entity){
    log("[Debug] objects type: " + entity.getType();
}

So passing Entity to our parameter wouldn't give us the method getType() which RS2Object has, so we would need to have RS2Object in our parameter

 

So we would need to have RS2Object in our parameter. And our code will work if he have it look like this

public void getTypeAndLog(RS2Object object){
    log("[Debug] objects type: " + object.getType();
}

I hope this guide helped you understand the types of Entities and how to use them correctly smile.png

Edited by Vilius

:doge:

 

Let's not forget about GroundDecoration, Player, WallDecoration, WallObject and other interactables.

Awesome guide, keep up the good work lad. :)

 

 

 

GroundItems will have brown name tags in game

BOQ56Cg.png

 

But pls? I'm pretty sure that is orange m8 :doge:

  • Author

Awesome guide, keep up the good work lad. smile.png

 

 

But pls? I'm pretty sure that is orange m8 doge.png

Fixed :feels:

  • 9 months later...

So what
"public void interactCustom(Entity entity, String action){
if(entity.isVisible())
entity.interact(action);
else
getCamera().toEntity(entity);
}"

 

Is basically doing is clicking it no matter what. I am assuming or could you maybe go into more depth of each parameter and its purpose.

This method passes a string called action to it using entity. So its basically clicking it right?

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.