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.

Cannot instantiate type Character

Featured Replies

Hello,

I just started scripting and taking baby steps to making a bot. However I dont know why I cannot instantiate type Character according to the OSBOT API. I know that its an abstract class so how would i go about using it syntax wise... also tried extending it in the class. Im trying to do character.isAnimation() method.

https://gyazo.com/3a7863f01f4a2a57caaf752444cb50b5

https://gyazo.com/843accad8fd0e2265226ffece7105e5c

Much help would be appreciated!

Edited by stussyboi187

As you said it is an abstract class; thus you can't instantiate it. You will need to extend it and provide a body to the abstract methods if you wish to use it. That being said, I can't see why you would need to do this, especially since you're new to scripting!

If you're looking to check if your player is animating, perhaps try something along these lines in your class which extends Script:

boolean animating = myPlayer().isAnimating();

.. or if you want the animation id:

int animationId = myPlayer().getAnimation();

Note that an id of (-1) is no animation.

GL!

Apa

Edit: Spelling

Edited by Apaec

  • Author

Hello @Apaec thank you for the response. I will try it out and let you know how it goes. There is many classes in the api lol... any good way to sift through all the classes?

  • Author
22 minutes ago, Apaec said:

As you said it is an abstract class; thus you can't instantiate it. You will need to extend it and provide a body to the abstract methods if you wish to use it. That being said, I can't see why you would need to do this, especially since you're new to scripting!

If you're looking to check if your player is animating, perhaps try something along these lines in your class which extends Script:


boolean animating = myPlayer().isAnimating();

.. or if you want the animation id:


int animationId = myPlayer().getAnimation();

Note that an id of (-1) is no animation.

GL!

Apa

Edit: Spelling

 

Hello @Apaec thank you for the response. I will try it out and let you know how it goes. There is many classes in the api lol... any good way to sift through all the classes?

1 hour ago, stussyboi187 said:

 

Hello @Apaec thank you for the response. I will try it out and let you know how it goes. There is many classes in the api lol... any good way to sift through all the classes?

I mean it really depends on what you're looking for! Navigating javadocs takes a bit of practice - if you're looking for a specific method, you can have a look in index view, but mostly class tree view is the easiest to digest. If you're unsure about anything, don't hesitate to let me know! The more scripts you write, the more fluent you will become with both Java and the API.

Apa

  • Author
1 hour ago, Apaec said:

I mean it really depends on what you're looking for! Navigating javadocs takes a bit of practice - if you're looking for a specific method, you can have a look in index view, but mostly class tree view is the easiest to digest. If you're unsure about anything, don't hesitate to let me know! The more scripts you write, the more fluent you will become with both Java and the API.

Apa

Hey thanks for the support. Hopefully one day I can become like you. I will try out the tree method to search for things.

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.