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.

Quick Prayer

Featured Replies

Implementation for people to use in their scripts to support quick prayer. Probably a more viable option just to have users select using quick prayers instead of manually selecting/having the bot turn on the prayers they need.

import org.osbot.script.Script;
import org.osbot.script.rs2.ui.RS2Interface;
import org.osbot.script.rs2.ui.RS2InterfaceChild;
import org.osbot.script.rs2.ui.Tab;

/**
 * Created with IntelliJ IDEA
 * User: Anthony
 * Date: 5/18/2014
 */

public class QuickPrayerController {

	private final Script sI;

	public QuickPrayerController(final Script sI) {
		this.sI = sI;
	}

	/**
	 * Checks if orbs are currently enabled for the player
	 *
	 * @return whether orbs are enabled or not
	 */
	public boolean areOrbsEnabled() {
		return sI.client.getConfig(1055) == 16;
	}

	/**
	 * Toggles data orbs on or off
	 *
	 * @param off whether to toggle off
	 * @return successful or unable to complete operation
	 * @throws InterruptedException
	 */
	public boolean toggleOrbs(boolean off) throws InterruptedException {
		boolean returnValue = false;
		if (!areOrbsEnabled() == off) {
			returnValue = false;
		}
		else {
			if (!sI.currentTab().equals(Tab.SETTINGS)) {
				sI.openTab(Tab.SETTINGS);
			}
			if (sI.currentTab().equals(Tab.SETTINGS)) {
				final RS2Interface parent = sI.client.getInterface(261);
				if (parent != null) {
					final RS2InterfaceChild child = parent.getChild(9);
					if (child != null && child.isVisible()) {
						returnValue = child.interact();
					}
				}
			}
		}
		return returnValue;
	}

	/**
	 * Checks if quick prayer is turned on
	 *
	 * @return whether quick prayer is activated or not
	 */
	public boolean isQuickPrayerOn() {
		return sI.client.getConfig(83) > 0;
	}

	/**
	 * Toggles quick prayer on or off
	 *
	 * @param off whether to toggle off
	 * @return successful or unable to complete operation
	 * @throws InterruptedException
	 */
	public boolean toggleQuickPrayer(boolean off) throws InterruptedException {
		boolean returnValue = false;
		if (!areOrbsEnabled() || !isQuickPrayerOn() == off) {
			returnValue = false;
		}
		else {
			final RS2Interface parent = sI.client.getInterface(548);
			if (parent != null) {
				final RS2InterfaceChild child = parent.getChild(85);
				if (child != null && child.isVisible()) {
					returnValue = child.interact();
				}
			}
		}
		return returnValue;
	}

}

Edited by Swizzbeat

But it's final?

but it's not static final

u only DO_DIS for constants

final

yeh, no

Edited by Rawr

Looks good :)

I'd get rid of a lot of unnecessary brackets, and I don't know why you are using returnValue variable, just return that (you aren't doing anything after checking anyways).

  • Author

Looks good smile.png

I'd get rid of a lot of unnecessary brackets, and I don't know why you are using returnValue variable, just return that (you aren't doing anything after checking anyways).

I prefer brackets because in my opinion it looks neater as compared to just having an indented block to show scope, and I'm using a variable to hold the return value because apparently it's the conventionally correct thing to do with in the business world. Mine as well start now :p

The final keyword doesn't necessarily make it a constant.

Yeah I've had bad assumptions due to learning Java on my own. cleared it up for me :)

Guest
This topic is now closed to further replies.

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.