Shnocky Posted January 14, 2014 Share Posted January 14, 2014 (edited) my first snippet i was messing around trying to write a method to interact with an interface, i came up with this. It seems to work good updated, Thanks Swizzbeat & Pseudo for the updated methods ! public boolean interactWithInterface(int parent, int child, String action) throws InterruptedException { RS2InterfaceChild ic = this.client.getInterface(parent).getChild(child); return ic != null && ic.isVisible() && ic.interact(action); } the way you use it: interactWithInterface(parentId, ChildId, Action); example of use: interactWithInterface(304, 3, "Make X"); this would click the make x option on the fletching interface. Hope it comes in handy Edited January 14, 2014 by Shnocky Link to comment Share on other sites More sharing options...
While Posted January 14, 2014 Share Posted January 14, 2014 RS2InterfaceChild Next = null; make that next and not Next Link to comment Share on other sites More sharing options...
Swizzbeat Posted January 14, 2014 Share Posted January 14, 2014 (edited) I'm not sure why your settings up a child variable? Why not just do (as well as naming your variables with the correct conventions): private boolean interactWithInterface(int parent, int child, String interaction) throws InterruptedException { RS2Interface interface = client.getInterface(parent); if (interface != null && interface.isVisible()) { interface.getChild(child).interact(interaction); return true; } return false; } isVisible() already checks for child elements being drawn, so there's no reason to make am RS2InterfaceChild variable. A regular RS2Interface works fine. Edited January 14, 2014 by Swizzbeat 1 Link to comment Share on other sites More sharing options...
Shnocky Posted January 14, 2014 Author Share Posted January 14, 2014 I'm not sure why your settings up a child variable? Why not just do (as well as naming your variables with the correct conventions): private boolean interactWithInterface(int parent, int child, String interaction) throws InterruptedException { RS2Interface interface = client.getInterface(parent); if (interface != null && interface.isVisible()) { interface.getChild(child).interact(interaction); return true; } return false; } isVisible() already checks for child elements being drawn, so there's no reason to make am RS2InterfaceChild variable. A regular RS2Interface works fine. thanks, i didn't realize that ill update it! make that next and not Next Yeah forgot that :P Link to comment Share on other sites More sharing options...
Pseudo Posted January 14, 2014 Share Posted January 14, 2014 (edited) public boolean interactWithInterface(int parent, int child, String action) throws InterruptedException { RS2InterfaceChild ic = this.client.getInterface(parent).getChild(child); return ic != null && ic.isVisible() && ic.interact(action); } ^ Should work, I haven't tested it. Also please don't take offence at me posting this, people will be grateful for your contribution, just trying to outline how things can be done simpler/in less code with the same outcome. Good work, keep at it. Edited January 14, 2014 by Pseudo 1 Link to comment Share on other sites More sharing options...
Shnocky Posted January 14, 2014 Author Share Posted January 14, 2014 public boolean interactWithInterface(int parent, int child, String action) throws InterruptedException { RS2InterfaceChild ic = this.client.getInterface(parent).getChild(child); return ic != null && ic.isVisible() && ic.interact(action); } ^ Should work, I haven't tested it. Also please don't take offence at me posting this, people will be grateful for your contribution, just trying to outline how things can be done simpler/in less code with the same outcome. Good work, keep at it. hmm, when i get a chance ill test this. And no i don't take any offence to that. just trying to give back to the community thats helped me so much :p and theres always room for improvements on code Link to comment Share on other sites More sharing options...
Shnocky Posted January 14, 2014 Author Share Posted January 14, 2014 Just tested it Pseudo, honestly for some reason it clicks so much more accurate and smoother lol. idek why. 1 Link to comment Share on other sites More sharing options...
HelloPeeps Posted January 17, 2014 Share Posted January 17, 2014 (edited) Hi guys, this is really useful thanks, but am I able to use this function for click in the chat window? i.e. "Click here to Continue" and selecting options in the menu? if so how do I set it? I can only get it to click on talk-to on the game screen. also i'm struggling to see what the parent and child ids are? looked in the api but it aint helping Edited January 17, 2014 by blood1000 Link to comment Share on other sites More sharing options...
Pseudo Posted January 17, 2014 Share Posted January 17, 2014 Client settings, go in to Advanced and check 'Interfaces' Then hover over the interface you want to interact with. The color of the box will co-respond to two numbers that show up on the side of your screen, they are parent, child. In order. 1 Link to comment Share on other sites More sharing options...
HelloPeeps Posted January 17, 2014 Share Posted January 17, 2014 Client settings, go in to Advanced and check 'Interfaces' Then hover over the interface you want to interact with. The color of the box will co-respond to two numbers that show up on the side of your screen, they are parent, child. In order. Thank you so much Link to comment Share on other sites More sharing options...
HelloPeeps Posted January 17, 2014 Share Posted January 17, 2014 (edited) double post sorry :\ Edited January 17, 2014 by blood1000 Link to comment Share on other sites More sharing options...