Bobrocket Posted May 30, 2015 Share Posted May 30, 2015 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. Quote Link to comment Share on other sites More sharing options...
Woody Posted May 30, 2015 Share Posted May 30, 2015 (edited) 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, 2015 by Woody Quote Link to comment Share on other sites More sharing options...
Czar Posted May 30, 2015 Share Posted May 30, 2015 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' Quote Link to comment Share on other sites More sharing options...
Bobrocket Posted May 30, 2015 Author Share Posted May 30, 2015 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". Quote Link to comment Share on other sites More sharing options...
Czar Posted May 30, 2015 Share Posted May 30, 2015 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 Quote Link to comment Share on other sites More sharing options...
Bobrocket Posted May 30, 2015 Author Share Posted May 30, 2015 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. Quote Link to comment Share on other sites More sharing options...
Flamezzz Posted May 30, 2015 Share Posted May 30, 2015 you could use position.interact(bot, "Walk here") 1 Quote Link to comment Share on other sites More sharing options...
Bobrocket Posted May 30, 2015 Author Share Posted May 30, 2015 you could use position.interact(bot, "Walk here") This works brilliantly, thank you so much Quote Link to comment Share on other sites More sharing options...
FrostBug Posted May 31, 2015 Share Posted May 31, 2015 (edited) 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, 2015 by FrostBug Quote Link to comment Share on other sites More sharing options...