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.

Scripting with classes

Featured Replies

I am new to scripting and so far when I created a script, I put it all in one class and things went pretty smoothly. But now I wanted to learn how to script while also using different classes and Ive tried stuff but nothing worked and I couldn't fin a tutorial on this anywhere. Would be awesome if someone could link a tutorial or something :)

Edited by TorRS

Hello,

There are many ways of doing this. 

The Most Lazy Static Var of MethodProvider in Script

public class TopLevel extends Script {

    public static MethodProvider methodProvider;
    public void onStart() throws InterruptedException {
     methodProvider =this;
    }
....

Call it anywere with TopLevel.methodProvider

 

Lazy way when you make a new class hand it the MethodProvider and store it in the class like so

public class SomeClass{
    final MethodProvider mp;
    public SomeClass(final MethodProvider mp){
        this.mp = mp;
        
    }
    public void someMethod(){
        mp.getBank().open();
        
    }
}

 

The more "Professional" away were you extend MethodProvider and exchange Context.

 

public class SomeClass extends MethodProvider  {
 
}


 

public class TopLevel extends Script {

	MethodProvider something;
    public void onStart() throws InterruptedException {
  	something = 	new SomeClass();
   something.exchangeContext(getBot());
    }
....

 

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.