Jump to content

Strange issue making pie shells


sudoinit6

Recommended Posts

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?

 

 
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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