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.

Getting nearby objects

Featured Replies

Which methods do I utlize to create instances of GroundItems/other entities? I am trying to create an object for a bank-booth, an attackable NPC and an item on the ground.

 

 

In OSbot 1 these methods look like:

 

GroundItem herb = SomeClass.closestGroundItemForName("Herb")

 

NPC druid = SomeClass.closestAttackableNPCForName("Chaos druid")

 

etc.

 

 

I look forward to your guys' help, in the mean time I'm going to dive back in to the API docs to see if I can find an answer

Edited by rooney

Which methods do I utlize to create instances of RS2Objects? I am trying to create an object for a bank-booth, an attackable NPC and an item on the ground.

 

 

In OSbot 1 these methods look like:

 

GroundItem herb = SomeClass.closestGroundItemForName("Herb")

 

NPC druid = SomeClass.closestAttackableNPCForName("Chaos druid")

 

etc.

 

 

I look forward to your guys' help, in the mean time I'm going to dive back in to the API docs to see if I can find an answer

 

RS2Object object = objects.closest();

NPC npc = npcs.closest();

same for the other objects

 

If you want to get those in another class you'll have to pass the Script object :)

Edited by Khaleesi

As stated above, using:

RS2Object temp = objects.closest("Name here");
GroundItem i = grounditems.closest("Name here");
NPC n = npcs.closest("Name here");

It is definitely worth jumping into the API and familiarizing yourself with it, also make sure you import the correct objects and not the legacy ones ^_^

 

  • Author

RS2Object object = objects.closest();

NPC npc = npcs.closest();

same for the other objects

 

If you want to get those in another class you'll have to pass the Script object smile.png

 

Ooo thank you very much!

 

Now I understand inheritance much better. I didn't see the closest() method because I was only looking at the methods that were specific to each class, though all of these classes (grounditem, npc etc.) are subclasses of the Entity class.

 

Can you clarify what you mean by having to pass the Script object?

 

Currently I am working on my first script and I have only one class file. I assume you mean something about having separate class files.

 

Would the Script object be passed into the constructor?

 

So something like druidKiller(Script sA)?

Ooo thank you very much!

 

Now I understand inheritance much better. I didn't see the closest() method because I was only looking at the methods that were specific to each class, though all of these classes (grounditem, npc etc.) are subclasses of the Entity class.

 

Can you clarify what you mean by having to pass the Script object?

 

Currently I am working on my first script and I have only one class file. I assume you mean something about having separate class files.

 

Would the Script object be passed into the constructor?

 

So something like druidKiller(Script sA)?

 

Yes you can pass it in the constructor :)

 

Like this:

public class AlKharidKiller {

private Script script;
	
public AlKharidKiller(Script script){
	this.script = script;
}

Goodluck :)

If you got anymore question you can always add me on skype!

Because your only using one class, you can extend the script class. Rather than initialing it in you constructor. Since your extending script, you inherit all there sub class and methods. Good luck on your script

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.