MightySir2 Posted August 10, 2015 Share Posted August 10, 2015 i have a script for tanning, but when character trades with NPC there is huge(5 sec) delay in which the character doesnt tan hides : any help would be appreciated conditions: if (inventory.isEmptyExcept(995)) //just withdraws hides to initiate script return State.BANK; if(inventory.contains(1743)&&bank.isOpen()) //if there is tanned hides and bank is open it deposits them/ withdraws untanned hides return State.BANKB; if(inventory.contains(1743)) //returns to bank from tanner to open it return State.BACK; if(ellis!=null&&inventory.contains(1739)) //tans hides when at tanner return State.TAN; if(inventory.contains(1739)) //goes to tanner from bank return State.WALK; tan action: case TAN: NPC ellis = npcs.closest("Ellis"); ellis.interact("Trade"); sleep(random(10, 15)); getWidgets().getWidgetContainingText("Hard leather").interact("Tan All"); sleep(random(50, 200)); break; Quote Link to comment Share on other sites More sharing options...
Psvxe Posted August 10, 2015 Share Posted August 10, 2015 Use conditional wait and return if next widget is visible. 1 Quote Link to comment Share on other sites More sharing options...
itzDot Posted August 10, 2015 Share Posted August 10, 2015 i think the problem could be where you declared the npc inside the TAN but. u refer to it in the decision processing, and I feel like the decsion processing comes before the case TAN. I could be wrong dou xD 1 Quote Link to comment Share on other sites More sharing options...
MightySir2 Posted August 10, 2015 Author Share Posted August 10, 2015 still delay Quote Link to comment Share on other sites More sharing options...
Apaec Posted August 10, 2015 Share Posted August 10, 2015 (edited) case TAN: RS2Widget w = getWidgets().getWidgetContainingText("Hard leather"); if (w != null && w.isVisible()) { w.interact("Tan All"); } else { NPC ellis = npcs.closest("Ellis"); if (ellis != null && ellis.exists()) { ellis.interact("Trade"); //either put a conditional sleep until interface is open here, or just stick with a static sleep and let state machine do the work eg: sleep(random(400,500) + random(400,500)); } else { sleep(random(400,500) + random(400,500)); } break; Re-written tan case... change the tan condition in the getState to: if(ellis!=null&& ellis.exists() && inventory.contains(1739)) //tans hides when at tanner return State.TAN; Edited August 10, 2015 by Apaec 2 Quote Link to comment Share on other sites More sharing options...
MightySir2 Posted August 10, 2015 Author Share Posted August 10, 2015 THANK YOOOUUUU!!!111!!!!1!!! Quote Link to comment Share on other sites More sharing options...