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.

Get the first option of a context menu?

Featured Replies

What I mean is that item in the top left when hovering over something interactive:

c2f4422ff5d418f075963cd7bed475d5.png

How can I get this? For example, if it's "Steal-from", I left click, if not I right click.

Try using widgets. Otherwise you could open menu and use menu.getMenu(). You'll get all menu options stored in a list. Thereafter you could loop through the list and find the menu action you are looking for.

 

EDIT: You could also use EntityDefinition

RS2Object stall = objects.closest("Silk stall");

String[] actions = stall.getDefinition().getActions();

Edited by Woody

object.getActions()[0] for the first option in the index*

 

careful though, some objects have null options, so you may want to make a small method to filter out all the null options

 

e.g. I tried doing this for my bank method, (bank chests have 'use', bank booths have 'bank') however the bank booth's first hidden option was null, then it was 'Bank'

  • Author

object.getActions()[0] for the first option in the index*

 

careful though, some objects have null options, so you may want to make a small method to filter out all the null options

 

e.g. I tried doing this for my bank method, (bank chests have 'use', bank booths have 'bank') however the bank booth's first hidden option was null, then it was 'Bank'

Thank you :)

Will this still work if there are things in the way? For example, if there is a guard in the way the first option would be "Pickpocket" for the guard, but the first option for the stall is always "Steal-from".

 

Thank you smile.png

Will this still work if there are things in the way? For example, if there is a guard in the way the first option would be "Pickpocket" for the guard, but the first option for the stall is always "Steal-from".

 

 

yes it will, it only grabs the options for that specific object

  • Author

yes it will, it only grabs the options for that specific object

I fixed it a different way:

if (getMouse().getOnCursorCount() > 1) {
	if (lock == 0) stall.interact("Steal-from");
	else log("Locked!!");
}
else {
	if (lock == 0) getMouse().click(false);
	else log("Locked!!");
}

Seems to work better for me. No idea why :/

 

Another problem I'm having: both localWalker and getMap() refuse to move my character one square to the left..

while (!getMap().walk(p)) { }
log("trying to walk " + myPlayer().getPosition() + " " + p);

It will log, so it shows that the while loop ends (indicating that the walk has executed) although the mouse doesn't move and the neither does the player; it's stuck there forever.

 

Not sure if still relevant, but a way to get the general uptext is:

	/*
	 * Get the mouse uptext
	 */
	public String getUpText() {
		List<Option> menu = getMenuAPI().getMenu();
		if (menu != null && !menu.isEmpty()) {
			return menu.get(0).action;
		}
		return "Cancel";
	}

Despite the nature of the code, it does not require you to have a right-click menu open.

Edited by FrostBug

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.