May 30, 201510 yr What I mean is that item in the top left when hovering over something interactive: How can I get this? For example, if it's "Steal-from", I left click, if not I right click.
May 30, 201510 yr 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 May 30, 201510 yr by Woody
May 30, 201510 yr 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'
May 30, 201510 yr 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".
May 30, 201510 yr 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". yes it will, it only grabs the options for that specific object
May 30, 201510 yr 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.
May 30, 201510 yr Author you could use position.interact(bot, "Walk here") This works brilliantly, thank you so much
May 31, 201510 yr 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 May 31, 201510 yr by FrostBug
Create an account or sign in to comment