Jump to content

Strange issue making pie shells


Recommended Posts

Posted

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?

 

 
Posted
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.

Posted
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

Posted

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 :)

 

  • Like 1
Posted
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.

Posted (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 by harrypotter

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...