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.

Temp fix to toggling run on\off

Featured Replies

public void toggleRun() throws Exception {
        if (currentTab() != Tab.SETTINGS) {
            openTab(Tab.SETTINGS);
            sleep(300+random(700));
        }
        client.getInterface(261).getChild(34).interact();
    }

quick fix until the hook is updated in the api.

		private void toogleRun() throws InterruptedException {
			if (client.getRunEnergy()>=50 && !this.isRunning())	{
		        selectInterfaceOption(548, 34, "Options");
		        sleep(random(1200, 1800));
		        selectInterfaceOption(261, 34, "Toggle Run");
		        sleep(random(1200, 1800));
			}
		}

mine

private void toogleRun() throws InterruptedException {			if (client.getRunEnergy()>=50 && !this.isRunning())	{		        selectInterfaceOption(548, 34, "Options");		        sleep(random(1200, 1800));		        selectInterfaceOption(261, 34, "Toggle Run");		        sleep(random(1200, 1800));			}		}
mine
Add some failsafes to that.
  • Author

>.< your script should already account for failsafes and relooping....

 

this is simply to replace the setRunning() method in the mean time. 


/**

* The <code>openTab(Setting)</code> will automatically check to make sure

* that the desired tab is already present. If not, it will open it.

*

* Thereafter, we can check to see if we interact with the "run" toggle

* button by returning whether we interacted with it via

* <code>selectInterfaceOption(int, int)</code>

*

* @return

* <tt>We interacted with the "run" toggle button</tt>

* @throws InterruptedException

* Interaction was interrupted

*/

public boolean toggleRun() throws InterruptedException {

return openTab(Tab.SETTINGS) && selectInterfaceOption(261, 34);

}

Edited by liverare

 

private void toogleRun() throws InterruptedException {			if (client.getRunEnergy()>=50 && !this.isRunning())	{		        selectInterfaceOption(548, 34, "Options");		        sleep(random(1200, 1800));		        selectInterfaceOption(261, 34, "Toggle Run");		        sleep(random(1200, 1800));			}		}
mine
Add some failsafes to that.

 

what you mean failsafe, it always get it on the first try lol


if(script.client.getMyPlayer()!=null && !script.isRunning() )

script.setRunning(true);

 if(script.client.getMyPlayer()!=null && !script.isRunning() )
            script.setRunning(true);

they need to update their method its a bit fucked up

These temp fixes are still better than original method due to its missclicking on random interfaces in the settings tab.


private void setRun() throws InterruptedException {

if (currentTab() != Tab.SETTINGS){

openTab(Tab.SETTINGS);

sleep(random(300,500));

}

if (currentTab() == Tab.SETTINGS){

if (client.getInterface(261)!= null){

client.getInterface(261).getChild(34).interact("Toggle Run");

sleep(random(300,500));

}

if (client.getConfig(173) == 0){

return;

}

}

}

wow big money baller, my method is 4 line and still does the same thing that yours does :P

 

wow big money baller, my method is 4 line and still does the same thing that yours does tongue.png

I'd rather do it right the first time rather than misclick the first time and reloop.

private void setRun() throws InterruptedException {
        if (currentTab() != Tab.SETTINGS){
            openTab(Tab.SETTINGS);
            sleep(random(300,500));
        }
        if (currentTab() == Tab.SETTINGS){
            if (client.getInterface(261)!= null){
                client.getInterface(261).getChild(34).interact("Toggle Run");
                        sleep(random(300,500));
                    }
                


            if (client.getConfig(173) == 0){
                return;
            }
        }
    }

 

Up yo' game, bitch ********a. smile.png Let's safe it like a motherfucker:

	/**
	 * @param on
	 *            The state the run will be set to
	 * @return
	 * 		<tt>Run is toggled off/on to our desire</tt>
	 * @throws InterruptedException
	 * 		Interactions were interrupted
	 */
	public boolean setRun(boolean on) throws InterruptedException {

		// Find out the current state of "run"
		int i = client.getConfig(173);

		// Declare a new RS2Interface variable for later
		RS2Interface j = null;

		// Check to see if the state is on and that's our desired outcome, or
		// vice versa
		if ((on && i == 1) || (!on && i == 0))
			return true; // Successful state--even if no interactions were
							// needed. Return true.

		// Check to see if we "can't" open Setting's tab
		else if (!openTab(Tab.SETTINGS)) {

			// We can't, so that's a problem.
			throw new RuntimeException("Unable to open the Setting's tab!");

			// Define the interface variable and check to see if it doesn't
			// exist or it does, but isn't valid.
		} else if ((j = client.getInterface(261)) == null || !j.isValid()) {

			// The interface is either null or invalid, so that's a problem
			throw new RuntimeException(
					"We're in Settings, but the interface isn't valid!?");

			/*
			 * Final selector state, assume:
			 * 	1. Our desired Run state isn't selected
			 * 	2. We're in the Setting's tab
			 * 	3. The "j" RS2Interface variable exists and is valid
			 */
		} else {

			// Assume that there's no client change, so the child "34" is valid and interact.

			/*
                         * EDITED CODE (thanks Xavier):
                         * This function WILL ONLY RETURN FALSE if we did NOT interact
                         * with the 'run' toggle-button. This condition will determine
                         * whether another recursive check is exhibited.
                         * 
			 * Recurse through this entire method again. The next recursion
			 * should end right at the first selector that checks the desired
			 * state to the actual state.
			 * 
			 * Use the same parameter as before
			 */
			return j.getChild(34).interact() && setRun(on);
		}
	}

Without comments, yo':

	/**
	 * @param on
	 *            The state the run will be set to
	 * @return
	 * 		<tt>Run is toggled off/on to our desire</tt>
	 * @throws InterruptedException
	 * 		Interactions were interrupted
	 */
	public boolean setRun(boolean on) throws InterruptedException {
		int i = client.getConfig(173);
		RS2Interface j = null;
		if ((on && i == 1) || (!on && i == 0))
			return true;
		else if (!openTab(Tab.SETTINGS)) {
			throw new RuntimeException("Unable to open the Setting's tab!");
		} else if ((j = client.getInterface(261)) == null || !j.isValid()) {
			throw new RuntimeException(
					"We're in Settings, but the interface isn't valid!?");
		} else {
			return j.getChild(34).interact() && setRun(on);
		}
	}

Xavier caught a flaw in my first code-post, so I've updated them. The problem being: The old bool method wouldn't have returned false at any point, but rather; return true or throw exceptions.

 

Good catch, Xavier. Hat's off to you, good sir.

 

 

Edited by liverare

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.