blabla123 Posted May 28, 2014 Share Posted May 28, 2014 if (player.getPosition().distance(new Position(2456, 3093, 0)) <= 4) { walkMiniMap(new Position(2457,3105,0)); sleep(random(2000,2200)); } else if (balloonGuy != null && !client.getInterface(469).isVisible()) { if(balloonGuy.isVisible()) { balloonGuy.interact("Fly"); sleep(random(2000,2200)); } } else if (client.getInterface(469).isVisible()) { // this seems to be doing nothing, where did I do a mistake? client.getInterface(469).getChild(26).interact(); sleep(random(8000,9000)); } So I walk up to the guy, interact with him - the interface opens up. Then it waits a little while, closes the interface and interacts with the guy again - like it ignores the last "else if" completely. Also if anyone knows of some rectangle area interaction thread where it was discussed - a link would be appreciated as I remember seeing it somwhere and even following it, but somehow the list of threads I follow is being reset like quite often Link to comment Share on other sites More sharing options...
Swizzbeat Posted May 28, 2014 Share Posted May 28, 2014 (edited) It's probably throwing an exception since you're invoking #isVisible() on a null instance. Create an RS2Interface object like so: final RS2Interface parent = client.getInterface(469); and do a null check on it before doing any type of interaction/method. Edited May 28, 2014 by Swizzbeat 1 Link to comment Share on other sites More sharing options...
blabla123 Posted May 28, 2014 Author Share Posted May 28, 2014 Declared final RS2Interface parent = client.getInterface(469); at the beginning of my onLoop(). Then changed the code in the body to this: if (player.getPosition().distance(new Position(2456, 3093, 0)) <= 4) { walkMiniMap(new Position(2457, 3105, 0)); sleep(random(2000, 2200)); } else if (balloonGuy != null) { if (balloonGuy.isVisible()) { balloonGuy.interact("Fly"); sleep(random(2000, 2200)); } else { client.moveCameraToEntity(balloonGuy); } } else if (parent != null) { // change here if (client.getInterface(469).isVisible()) { client.getInterface(469).getChild(25).interact(); sleep(random(8000, 9000)); } } And it still does the same thing... Link to comment Share on other sites More sharing options...
Precise Posted May 31, 2014 Share Posted May 31, 2014 You have to null check the child interface as well. Link to comment Share on other sites More sharing options...
blabla123 Posted May 31, 2014 Author Share Posted May 31, 2014 (edited) Thanks Swizz... if (player.getPosition().distance(new Position(2456, 3093, 0)) <= 4) { walkMiniMap(new Position(2456 +random(0,2), 3104 +random(0,2), 0)); sleep(random(2000, 2200)); } else if (balloonGuy != null && !new ColorPicker(bot).isColorAt(275, 175, new Color(168, 144, 97))) { if (balloonGuy.isVisible()) { if(!player.isMoving()) { balloonGuy.interact("Fly"); sleep(random(2000, 2200)); } } else { client.moveCameraToEntity(balloonGuy); } } else if (new ColorPicker(bot).isColorAt(275, 175, new Color(168, 144, 97))) { //gotta love color picker client.moveMouseTo(new RectangleDestination(365, 40, 70, 15), false, true, false); sleep(random(8000,9000)); } Edited May 31, 2014 by blabla123 Link to comment Share on other sites More sharing options...