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.

Methods Template?

Featured Replies

I was wondering if anyone had a barebones methods template? Kind of similar to the one I have created below? I am looking at implementing methods now instead of placing everything in a single loop.

 

import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;

@ScriptManifest(name = "", logo = "", version = 1.0, author ="", info ="")
public class test extends Script {


    @Override
    public void onStart() throws InterruptedException {
        super.onStart();
    }

    @Override
    public int onLoop() throws InterruptedException {
        return 0;
    }

    @Override
    public void onExit() throws InterruptedException {
        super.onExit();
    }
}

How I go about it is like this:

import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;


@ScriptManifest(name = "Example", logo = "", version = 1, author = "Your name here", info = "Example script")



public class Example extends Script {
    
    private void exampleMethod() {
        // Put your method in here and call in the onLoop with conditions
    }
    
    
    
    
    @Override
    public int onLoop() throws InterruptedException {
        // if(Im where I need to be) { <--- Condition to run method
        // exampleMethod(); <--- Method is executed if condition met
        return 0;
    }
}

Not saying this is the "proper" OR best way to go about it but works for me. Have only used this for the simplest of tasks though. For more complex scripts I'm sure there's far better ways to structure it. 

Hope this helps.

I personally use a mix between a Task and a State 'framework'

For example, I'll have a Bank Task which contains code for banking. And in that class will be a switch statement that chances based on certain conditions, for example:

switch (getTaskState()) {
	case WALK_TO_BANK:
		// walk to bank etc
		break;

	case OPEN_BANK:
		// open bank
		break;

	// etc
}

private enum TaskState {
	WALK_TO_BANK,
	OPEN_BANK,
	BANK_ETC
}

private TaskState getTaskState() {
	if (!Bank.contains(Player)) {
		return TaskState.WALK_TO_BANK;
	
	// etc
}

 

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.