January 15, 20188 yr Hi, I am using the following as my fighting part of my script: Was wondering if there were any additions people would make to improve this? if (!getCombat().isFighting()) { //not in combat if (warrior != null) { //if it exists if (warrior.interact("Attack")) { //attack new ConditionalSleep(3000, 600) { //sleep for 3 seconds or until the condition is true @Override public boolean condition() throws InterruptedException { return getCombat().isFighting(); } }.sleep(); } } }
January 15, 20188 yr Author 3 minutes ago, Apaec said: Looks good - If it runs well then there's no problem! Thanks, yeah it does run well, was just wondering if there were any extra bits i could add but thanks for fb
January 15, 20188 yr Author 11 minutes ago, El_Maestro said: This is a great start. As APA said, if it works there is no problems! If you want to decrease the delay between individual npc interactions make your own isFighting() method that takes an npc as a parameter. Would this help you think or the inbuilt one good enough?
January 15, 20188 yr Also you could always take advantage of the return value of the conditional sleep to determine what to do if the interaction for whatever reason fails (misclick, ...) e.g: if (!getCombat().isFighting()) { //not in combat if (warrior != null) { //if it exists if (warrior.interact("Attack") && new ConditionalSleep(3000, 600) { @Override public boolean condition() throws InterruptedException { return getCombat().isFighting(); } }.sleep()) { log("Success!"); } else log("Fail :("); } }
January 15, 20188 yr Author 1 hour ago, Apaec said: Also you could always take advantage of the return value of the conditional sleep to determine what to do if the interaction for whatever reason fails (misclick, ...) e.g: if (!getCombat().isFighting()) { //not in combat if (warrior != null) { //if it exists if (warrior.interact("Attack") && new ConditionalSleep(3000, 600) { @Override public boolean condition() throws InterruptedException { return getCombat().isFighting(); } }.sleep()) { log("Success!"); } else log("Fail :("); } } ah fair enough
Create an account or sign in to comment