sudoinit6 Posted April 22, 2017 Share Posted April 22, 2017 I have used this syntax before but for some reason this isn't working. It never gets beyond the second interact and then it loops back and starts again never making any shells. script.inventory.getItem("Pie dish").interact("Use"); Script.sleep(Script.random(2000, 3000)); script.inventory.getItem("Pastry dough").interact("Use"); Script.sleep(Script.random(800, 1500)); script.log("debug 1"); It never gets to writing to the log (or any other action I put there). Any idea what I am doing wrong? Quote Link to comment Share on other sites More sharing options...
Deceiver Posted April 22, 2017 Share Posted April 22, 2017 interact item1 if inventory.isitemselected interact item 2 try that Quote Link to comment Share on other sites More sharing options...
Lewis Posted April 22, 2017 Share Posted April 22, 2017 if !item selected { select item } else { interact item 2 } Quote Link to comment Share on other sites More sharing options...
sudoinit6 Posted April 22, 2017 Author Share Posted April 22, 2017 1 minute ago, raijin said: interact item1 if inventory.isitemselected interact item 2 try that I should have added that the second interact is definitely working, the "How many would you like to make?" window appears. But after that nothing, the debug never shows in the log it just waits till the next loop and starts the interacts again. Quote Link to comment Share on other sites More sharing options...
paper Posted April 22, 2017 Share Posted April 22, 2017 16 minutes ago, sudoinit6 said: I should have added that the second interact is definitely working, the "How many would you like to make?" window appears. But after that nothing, the debug never shows in the log it just waits till the next loop and starts the interacts again. dont u gotta like, make it do the window Quote Link to comment Share on other sites More sharing options...
Apaec Posted April 22, 2017 Share Posted April 22, 2017 Try and write your script such that they are never relying on a method to execute correctly - as you're writing scripts for a live game, issues like latency drops and disconnects mean you can never fully rely on a method to correctly execute fully every time. To combat this, try and make your script more conditional, i.e if this then do that etc. Hopefully then it will be easier to debug 1 Quote Link to comment Share on other sites More sharing options...
Alek Posted April 28, 2017 Share Posted April 28, 2017 On 4/22/2017 at 6:23 PM, sudoinit6 said: I have used this syntax before but for some reason this isn't working. It never gets beyond the second interact and then it loops back and starts again never making any shells. script.inventory.getItem("Pie dish").interact("Use"); Script.sleep(Script.random(2000, 3000)); script.inventory.getItem("Pastry dough").interact("Use"); Script.sleep(Script.random(800, 1500)); script.log("debug 1"); It never gets to writing to the log (or any other action I put there). Any idea what I am doing wrong? Your script isn't sleeping as far as I can tell, even though it shouldn't matter because InteractionEvent takes care of that for you. Although it doesn't solve your issue, make Script.sleep -> script.sleep. Quote Link to comment Share on other sites More sharing options...
harrypotter Posted April 28, 2017 Share Posted April 28, 2017 (edited) On 4/22/2017 at 11:23 PM, sudoinit6 said: I have used this syntax before but for some reason this isn't working. It never gets beyond the second interact and then it loops back and starts again never making any shells. script.inventory.getItem("Pie dish").interact("Use"); Script.sleep(Script.random(2000, 3000)); script.inventory.getItem("Pastry dough").interact("Use"); Script.sleep(Script.random(800, 1500)); script.log("debug 1"); It never gets to writing to the log (or any other action I put there). Any idea what I am doing wrong? What I would do is start by structuring your script so that if an event fails at anytime, it will simply retry that action only, not the whole loop again (as @Apaec suggested): if (!inventory.isItemSelected()) { // Use first item // Sleep until inventory.isSelected() } else { // Use first item with second item // Sleep until finished making pie shell } Here is a full example taken from my AIO Herblore script: if (!script.inventory.isItemSelected()) { Item pestle = script.inventory.getItem("Pestle and mortar"); if (pestle != null) { if (pestle.interact("Use")) { Sleep.sleepUntil(() -> script.inventory.isItemSelected(), 5000); } } } else { int clickSlot = script.inventory.getSlot(itemToGrind); InventorySlotDestination itemSlot = new InventorySlotDestination(script.getBot(), clickSlot); script.getMouse().move(itemSlot); if (script.getMouse().click(false)) { Sleep.sleepUntil(() -> !script.inventory.contains(itemToGrind) || script.getDialogues().isPendingContinuation(), 120000); } } Edited April 28, 2017 by harrypotter Quote Link to comment Share on other sites More sharing options...