todamach Posted May 6, 2015 Share Posted May 6, 2015 I can only hover() this widget, but how could I click it? What I've tried so far: Mouse mouse = new Mouse(); mouse.click(mouse.getPosition().x, mouse.getPosition().y, false); ava.lang.NullPointerException at org.osbot.rs07.script.MethodProvider.execute(kc:642) at org.osbot.rs07.api.Mouse.click(no:157) Quote Link to comment Share on other sites More sharing options...
Flamezzz Posted May 6, 2015 Share Posted May 6, 2015 There already is a mouse, no need to create a new one :p Quote Link to comment Share on other sites More sharing options...
todamach Posted May 6, 2015 Author Share Posted May 6, 2015 (edited) It doesn't work without the first line though. edit: not like it works with it Edited May 6, 2015 by todamach Quote Link to comment Share on other sites More sharing options...
Flamezzz Posted May 6, 2015 Share Posted May 6, 2015 You should have access to the mouse api in your script, so you can use mouse.click(false) directly. You can not create a new mouse since that mouse doesn't have access to the bot instance and can therefore not inject mouse events. 1 Quote Link to comment Share on other sites More sharing options...
todamach Posted May 6, 2015 Author Share Posted May 6, 2015 Yeah, that was a silly mistake. Thank you very much for responding. It's a separate class with a constructor public MinMaxPrice(Script sI) { this.sI = sI; } So I have to do it like this: sI.mouse.click(sI.mouse.getPosition().x, sI.mouse.getPosition().y, false); Quote Link to comment Share on other sites More sharing options...
Rudie Posted May 6, 2015 Share Posted May 6, 2015 (edited) If you want to buy something at GE take a look at the GrandExchange class in the OSBot API. Edited May 6, 2015 by Rudie 1 Quote Link to comment Share on other sites More sharing options...
todamach Posted May 6, 2015 Author Share Posted May 6, 2015 If you want to buy something at GE take a look at the GrandExchange class in the OSBot API. Oh, I did. There's nothing in there for selecting an item from the widget that I've mentioned higher. Also, api for button to confirm offer (sell or buy) doesn't work too. setQuantity and getQuantity isn't working either. I made custom methods for all of that. Still, GE API is pretty decent. Can't complain. Quote Link to comment Share on other sites More sharing options...
Rudie Posted May 6, 2015 Share Posted May 6, 2015 Oh, I did. There's nothing in there for selecting an item from the widget that I've mentioned higher. Also, api for button to confirm offer (sell or buy) doesn't work too. setQuantity and getQuantity isn't working either. I made custom methods for all of that. Still, GE API is pretty decent. Can't complain. So, you just want to click where the mouse is hovering? That would be very simple: mouse.click(false); Quote Link to comment Share on other sites More sharing options...
todamach Posted May 6, 2015 Author Share Posted May 6, 2015 Yeah, I, kind of, figured it out at the start. Just made a silly mistake implementing it. Quote Link to comment Share on other sites More sharing options...
FrostBug Posted May 6, 2015 Share Posted May 6, 2015 RS2Widget widget = widgets.get(parentId, childId); if(widget != null) { widget.interact(); } or if(widget != null) { mouse.click(new RectangleDestination(bot, widget.getRectangle()); } Quote Link to comment Share on other sites More sharing options...
Tom Posted May 8, 2015 Share Posted May 8, 2015 RS2Widget widget = widgets.get(parentId, childId); if(widget != null) { widget.interact(); } or if(widget != null) { mouse.click(new RectangleDestination(bot, widget.getRectangle()); } Going off this, he would have to check the mini widget for every item that pops up, which might be a pain in the ass to store as it could change depending on how many items are filtered out using the search bar. E.g. User searches Feather Results: [Feather] [blue Feather] [Red Feather] Blue feathers widget might be 399, 11 for example, but if the user searches Blue Feather The result would just be: [blue Feather] and the widget could change to 399, 10 Quote Link to comment Share on other sites More sharing options...
FrostBug Posted May 8, 2015 Share Posted May 8, 2015 Going off this, he would have to check the mini widget for every item that pops up, which might be a pain in the ass to store as it could change depending on how many items are filtered out using the search bar. E.g. User searches Feather Results: [Feather] [blue Feather] [Red Feather] Blue feathers widget might be 399, 11 for example, but if the user searches Blue Feather The result would just be: [blue Feather] and the widget could change to 399, 10 It assumes that 'widget' is the correct widget (the correct item in the list). I'm not going to get into how you'll get that widget. You can use parentId, childId & gchildId; or you could use something like widgets.containingText How to interact with the widget is not changed by this Quote Link to comment Share on other sites More sharing options...
Tom Posted May 8, 2015 Share Posted May 8, 2015 It assumes that 'widget' is the correct widget (the correct item in the list). I'm not going to get into how you'll get that widget. You can use parentId, childId & gchildId; or you could use something like widgets.containingText How to interact with the widget is not changed by this Ahh yes, forgot about containingText. Quote Link to comment Share on other sites More sharing options...