scriptersteve Posted January 15, 2018 Share Posted January 15, 2018 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(); } } } Quote Link to comment Share on other sites More sharing options...
nvrsince Posted January 15, 2018 Share Posted January 15, 2018 no idea what im looking at fam all i see is sleep which is what im bout to do 5 Quote Link to comment Share on other sites More sharing options...
Apaec Posted January 15, 2018 Share Posted January 15, 2018 Looks good - If it runs well then there's no problem! Quote Link to comment Share on other sites More sharing options...
scriptersteve Posted January 15, 2018 Author Share Posted January 15, 2018 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 Quote Link to comment Share on other sites More sharing options...
scriptersteve Posted January 15, 2018 Author Share Posted January 15, 2018 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? Quote Link to comment Share on other sites More sharing options...
Apaec Posted January 15, 2018 Share Posted January 15, 2018 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 :("); } } 1 Quote Link to comment Share on other sites More sharing options...
scriptersteve Posted January 15, 2018 Author Share Posted January 15, 2018 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 Quote Link to comment Share on other sites More sharing options...