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.

Toggling run/checking run %?

Featured Replies

Hmm.. I used to be able to do this but I'm not sure how any more? I want to implement this into one of my scripts but I can't seem to get it this time around. 

 

I just need a method to check how much energy the player has and if there's a method to toggle it

Read the interface config # if it's 1 it's enabled and 0 it's disabled, then compare to how much energy you have left and interact with the button.

I thought this feature was already in API but I guess not...

openTab(Tab.SETTINGS);
sleep(random(100, 200));
client.getInterface(261).getChild(0).interact();
sleep(random(218, 721));

That's how you would interact with it, but I'm also stuck at the part on how to call it. If I try something like getRunEnergy() > 30 the bot just turns it on and off everytime the methods called. I think you'd need a boolean variable to turn on and off. Problem is I don't know how to detect if its off or not.

 

 

Read the interface config # if it's 1 it's enabled and 0 it's disabled, then compare to how much energy you have left and interact with the button.

I thought this feature was already in API but I guess not...

 

Just checked the interfaces and they don't change whether its on or off.

 

 

EDIT: Figured it out

 

If you start the script with run on, and use a message listener to figure out if its been turned off or not, you can then change a variable from true or false to detect whether to call the run function or not. Here it is:

boolean runCheck = true; //whether run is or or is not on checking variable

//message listener to receive the message you are out of energy
public void onMessage(String m) {
	if (m.toLowerCase().contains("whatever the out of run message is")) {
		runCheck = false;
	}
}

//whether to toggle run energy (add this to your main code when you want to check)
if (runCheck == false && client.getRunEnergy() > 30) {
        toggleRun();
}

//toggle run function
public void toggleRun() throws InterruptedException {
	openTab(Tab.SETTINGS);
	sleep(random(100, 200));
	client.getInterface(261).getChild(0).interact();
	sleep(random(218, 721));
        runCheck = true;
}

I just made this now so it may not work, but the logic tells me if should. Only problem is there's no failsafe in case the button somehow doesn't get clicked. This would mess it all up.

 

EDIT AGAIN: Theres no message when your run energy turns off. FML

Edited by Swizzbeat

^ Lol? So easy just to fetch the config which will display the run button either in red (actived = 1) or (default gray = 0) when disabled.
Also if you lose all your run energy you aren't notified in any other matter than run mode/button toggling off, no game message is sent.

 

# L2 clientconfigs/ interface scripting cs1/cs2

if (client.getRunEnergy() > 30 && client.getConfig(173) == 0) {
				sleep(400, 500);
				openTab(Tab.SETTINGS);
				sleep(random(200, 500));
				client.getInterface(261).getChild(46).interact();
				return 3000;
			}

Edited by rsdude282

  • Author
if (client.getRunEnergy() > 30 && client.getConfig(173) == 0) {
				sleep(400, 500);
				openTab(Tab.SETTINGS);
				sleep(random(200, 500));
				client.getInterface(261).getChild(46).interact();
				return 3000;
			}

Thanks bro if this works :) will test this later

Loled at previous posts.

 

To see if your player is running:

MethodProvider#isRunning

To get the amount of energy your player has left:

Client#getRunEnergy

To toggle run on/off:

setRunning(boolean run);

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.