Kozs Posted August 19, 2014 Posted August 19, 2014 My first time playing with this API. I wanted to figure out how to properly tell the bot to Make X when making arrow shafts.... This is what I got so far.. public void MakeShaft() throws InterruptedException { if(this.inventory.contains(Logs) && this.inventory.isFull()); Item Knifes = inventory.getItem(Knife); Item Log = inventory.getItem(Logs); Knifes.interact("Use"); Log.interact("Use"); interfaces.interactWithChild(305, 2, "Make 1"); while(myPlayer().isAnimating()){ sleep(1000); } }
FrostBug Posted August 19, 2014 Posted August 19, 2014 (edited) The interface takes a second or 2 to appear after using a knife on a log; You don't seem to be waiting for that. This means that the interaction will likely fail. Perhaps insert a conditionalsleep after using the knife on the log new ConditionalSleep(3000) { @Override public boolean condition() throws InterruptedException { return interfaces.getChild(305, 2) != null; } }.sleep(); Edited August 19, 2014 by FrostBug
Ericthecmh Posted August 19, 2014 Posted August 19, 2014 The interface takes a second or 2 to appear after using a knife on a log; You don't seem to be waiting for that. This means that the interaction will likely fail. Perhaps insert a conditionalsleep after using the knife on the log new ConditionalSleep(3000) { @Override public boolean condition() throws InterruptedException { return interfaces.getChild(305, 2) != null; } }.sleep(); Don't just check null, check isvisible as well
Kozs Posted August 19, 2014 Author Posted August 19, 2014 The interface takes a second or 2 to appear after using a knife on a log; You don't seem to be waiting for that. This means that the interaction will likely fail. Perhaps insert a conditionalsleep after using the knife on the log new ConditionalSleep(3000) { @Override public boolean condition() throws InterruptedException { return interfaces.getChild(305, 2) != null; } }.sleep(); It still shows up in time, but how do I make the script select "Make X" rather then one, due to it having to RIGHT Click first then select that.
Extreme Scripts Posted August 19, 2014 Posted August 19, 2014 It still shows up in time, but how do I make the script select "Make X" rather then one, due to it having to RIGHT Click first then select that. You can interact with the interface like so: interfaces.get(PARENT).getChild(CHILD).interact("Make-X"); Fill in the relevant fields of course ^_^
Kozs Posted August 19, 2014 Author Posted August 19, 2014 (edited) You can interact with the interface like so: interfaces.get(PARENT).getChild(CHILD).interact("Make-X"); Fill in the relevant fields of course Does not work, the script just hovers over it. If I made it "Make 1" it would work. Fixed ** Thanks Edited August 19, 2014 by Kozs