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.

CLI Support Made Easy

Featured Replies

Here's a quick way to get key/value pairs from your CLI parameters.

We can take:

-script TestScript:body.green-d'hide-body.legs.preists-robes.location.varrock.mode.attack

And convert it to:

BODY:green d'hide body
LEGS:priests robes
LOCATION:varrock
MODE:attack

You're probably wondering 'why are the keys uppercase?', well that's to signify what the bot thinks are keys. A little debugging and you'll be able to see what your bot sees.

The full-stop "." is our delimiter, and the hyphen "-" is our replacement for the space " " key.

Example code + template:

public class Test extends Script {

	Map<String, String> parameters;
	
	String mode;
	
	@Override
	public void onStart() throws InterruptedException {
		
		compileParameters();
		
		mode = parameters.get("mode");
	}

	@Override
	public int onLoop() throws InterruptedException {
		
		// log out the parameters for debugging purposes
		
		logger.debug(parameters);
		
		// use parameters
		
		if (mode != null && !mode.isEmpty()) {
			
			if (mode.equals("attack")) {
				
				// TODO - attack something
			}
		}
		
		return 1000;
	}
	
	/**
	 * Compiles OSBot parameters into key/value pairs
	 */
	private void compileParameters() {
		String rawParameterString = getParameters();
		String[] contents;
		String key;
		String value;
		parameters = new HashMap<>();
		if (rawParameterString != null && !rawParameterString.isEmpty()) {
			logger.debug(rawParameterString);
			contents = rawParameterString.split("\\.");
			if (contents != null && contents.length > 0) {
				for (int i = 0; i < contents.length; i += 2) {
					key = contents[i];
					key = key.toUpperCase();
					value = (i + 1 < contents.length ? contents[i + 1] : "");
					value = value.replaceAll("-", " ");
					parameters.put(key, value);
				}
			}
		}
	}

}

Have fun! :)

Edited by liverare

Awesome work ! love all your work as of late, so many useful snippets

have my fucking children

thanks cutie

 

B2XgyAG.png

Spoiler

liverare aka the snippet god

 

I appreciate the contribution of all your snippets! Learning a lot

Keep it up :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.