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.

Overwrite API functions

Featured Replies

I am looking to overwrite some of the API functions (Like world hop and break handler) to better suit scripts I make, but I can't figure out how this would be done.
I don't really know where or what to look for, so a general push in the right direction would be much appreciated! :) 

Edited by ItPoke
Examples for functions to overwrite

Break handler isn't really an API function, but a "Random Executor" (Group of event executors that are automatically triggered by some condition; like being logged out or in a  random event). Some of these can be overridden with the RandomExecutor#overrideOSBotRandom method, providing a new implementation. The break manager can be overridden like this.

For world hopping you can create your own methods that interact with the ingame world-switcher (See FrostHopper snippet for an example), but if you're looking for logged-out world switching, you'll have to disable the login-handler by using CLI, and provide your own custom login-handler that allows it.

  • Author

Great, exactly what I was looking for with the Random Executors :) 

However, with the world hopping thing, I would like to overwrite osbot API, since I also want to overwrite other API. In your world hopper you create a new class which you use. But I am going to use some osbot APIs which uses other osbot APIs that I want to overwrite, I heard this was possible. But don't really know how to overwrite the API.

48 minutes ago, ItPoke said:

Great, exactly what I was looking for with the Random Executors :) 

However, with the world hopping thing, I would like to overwrite osbot API, since I also want to overwrite other API. In your world hopper you create a new class which you use. But I am going to use some osbot APIs which uses other osbot APIs that I want to overwrite, I heard this was possible. But don't really know how to overwrite the API.

Not sure what it is you've read (and not 100% sure what you're trying to achieve either)

You can override OSBot API to the extent of creating classes that extend some API class and override certain public or protected methods. For example you might create a class called CustomWorlds which extends the Worlds class, and proceed to override the hopToP2PWorld method. This would allow you to create an instance of your CustomWorlds class and use it to hop to p2p worlds with your overridden implementation; however when using the MethodProvider to access the worlds API, you will still receive the instance of Worlds (not CustomWorlds) managed by the client. In turn, any other OSBot API that were to access the hopToP2PWorld method would not use your overridden variant either.

EDIT:
Actually, considering that all API fields in MethodProvider are public, you could set the worlds field, of the MethodProvider held by your Script instance, to an instance of your CustomWorlds class.

Edited by FrostBug

  • Author

Ahhh, cool! That's a great strong push in the right direction! Thank you very much! :D 

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.