SESH Posted May 6, 2015 Share Posted May 6, 2015 Is anyone else having problems with click()? Sometimes it clicks, sometimes it doesn't. I've had to resort to looping click()'s in my methods until they finally work to get it to actually click. The weird thing is that it moves to the pixel to click, it just doesn't click once it's there, and it only happens sometimes. Anyone know the reason for this? Thanks Quote Link to comment Share on other sites More sharing options...
Tom Posted May 6, 2015 Share Posted May 6, 2015 Is anyone else having problems with click()? Sometimes it clicks, sometimes it doesn't. I've had to resort to looping click()'s in my methods until they finally work to get it to actually click. The weird thing is that it moves to the pixel to click, it just doesn't click once it's there, and it only happens sometimes. Anyone know the reason for this? Thanks Show da code Quote Link to comment Share on other sites More sharing options...
SESH Posted May 6, 2015 Author Share Posted May 6, 2015 (edited) Show da code Here's a method I use to click a random coordinate in a shape with normal distribution: public boolean clickRandomXY(Shape region) { Rectangle r = region.getBounds(); int maxX = (int) r.getMaxX() - 1; int maxY = (int) r.getMaxY() - 1; int minX = (int) r.getMinX() + 1; int minY = (int) r.getMinY() + 1; int x, y; do { x = rand(minX, maxX); y = rand(minY, maxY); } while (!(x <= maxX) || !(x >= minX) || !(y <= maxY) || !(y >= minY)); return !mouse.click(x, y, false); } I know the code is a bit ugly, I apologize. rand() is my method for a random integer with normal distribution. Using this method, the mouse will move to the coordinates and then just not click sometimes. I also find it odd that click() returns true if the event failed... what's the reason for that? It goes against logic. Edited May 6, 2015 by SESH Quote Link to comment Share on other sites More sharing options...
Tom Posted May 6, 2015 Share Posted May 6, 2015 Here's a method I use to click a random coordinate in a shape with normal distribution: public boolean clickRandomXY(Shape region) { Rectangle r = region.getBounds(); int maxX = (int) r.getMaxX() - 1; int maxY = (int) r.getMaxY() - 1; int minX = (int) r.getMinX() + 1; int minY = (int) r.getMinY() + 1; int x, y; do { x = rand(minX, maxX); y = rand(minY, maxY); } while (!(x <= maxX) || !(x >= minX) || !(y <= maxY) || !(y >= minY)); return !mouse.click(x, y, false); } I know the code is a bit ugly, I apologize. rand() is my method for a random integer with normal distribution. Using this method, the mouse will move to the coordinates and then just not click sometimes. I also find it odd that click() returns true if the event failed... what's the reason for that? It goes against logic. By the look of it you arent actually defining the bounds of the rectangle, its just an empty object. E.g. Rectangle bounds = new Rectangle(465, 340, 100, 20); which defines a small rectangle for my paint. Quote Link to comment Share on other sites More sharing options...
SESH Posted May 6, 2015 Author Share Posted May 6, 2015 By the look of it you arent actually defining the bounds of the rectangle, its just an empty object. E.g. Rectangle bounds = new Rectangle(465, 340, 100, 20); which defines a small rectangle for my paint. The bounds come from the Shape given when the method is called... Quote Link to comment Share on other sites More sharing options...
Apaec Posted May 6, 2015 Share Posted May 6, 2015 By the look of it you arent actually defining the bounds of the rectangle, its just an empty object. E.g. Rectangle bounds = new Rectangle(465, 340, 100, 20); which defines a small rectangle for my paint. Rectangle r = region.getBounds(); Quote Link to comment Share on other sites More sharing options...
Tom Posted May 6, 2015 Share Posted May 6, 2015 (edited) The bounds come from the Shape given when the method is called... Oh shit didn't see that, one moment ill edit the post when i figure something out. public boolean clickRandomXY(Shape region) { Rectangle r = region.getBounds(); int maxX = (int) r.getMaxX() - 1; int maxY = (int) r.getMaxY() - 1; int minX = (int) r.getMinX() + 1; int minY = (int) r.getMinY() + 1; int x, y; x = rand(minX, maxX); y = rand(minY, maxY); if(x < maxX && x > minX && y < maxY && y > minY){ return !mouse.click(x, y, false); //This will return true as long as the client thinks it clicked } //I think you can also do if r.contains(){..................} return false; } Edited May 6, 2015 by Tom Quote Link to comment Share on other sites More sharing options...
SESH Posted May 6, 2015 Author Share Posted May 6, 2015 Oh shit didn't see that, one moment ill edit the post when i figure something out. public boolean clickRandomXY(Shape region) { Rectangle r = region.getBounds(); int maxX = (int) r.getMaxX() - 1; int maxY = (int) r.getMaxY() - 1; int minX = (int) r.getMinX() + 1; int minY = (int) r.getMinY() + 1; int x, y; x = rand(minX, maxX); y = rand(minY, maxY); if(x < maxX && x > minX && y < maxY && y > minY){ return !mouse.click(x, y, false); //This will return true as long as the client thinks it clicked } return false; } There's nothing wrong with the code besides click() though. The method is generating the right coordinates fine. I could write just click(30, 30, false); in my onLoop() and it still would only click sometimes. Other people have posted this same problem in this subforum. Something honestly has to be wrong with click(), but I don't know of any workarounds. Quote Link to comment Share on other sites More sharing options...
Tom Posted May 6, 2015 Share Posted May 6, 2015 There's nothing wrong with the code besides click() though. The method is generating the right coordinates fine. I could write just click(30, 30, false); in my onLoop() and it still would only click sometimes. Other people have posted this same problem in this subforum. Something honestly has to be wrong with click(), but I don't know of any workarounds. Might be worth creating a thread in the client bugs subforum, that way it will be fixed as soon as possible Quote Link to comment Share on other sites More sharing options...
SESH Posted May 6, 2015 Author Share Posted May 6, 2015 Might be worth creating a thread in the client bugs subforum, that way it will be fixed as soon as possible Alright thanks man Quote Link to comment Share on other sites More sharing options...
Khaleesi Posted May 6, 2015 Share Posted May 6, 2015 This is indeed an issue, the interact methods os osbot itself also have trouble clicking sometimes. It seems to skip the method once in a while. got idea how to solve ... It's something you have to live with Khaleesi Quote Link to comment Share on other sites More sharing options...