Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

Sign up now!

Mouse is not always accurate

Joined
Mar 22, 2015
Messages
75
I wrote a bot to make Anchovy pizza for me.
It kind of works...

Sometimes it mis-clicks and then eats things, or breaks in other scary ways.

Here's a video to showcase the problem
To view this content we will need your consent to set third party cookies.
For more detailed information, see our cookies page.

This is the code I'm using to make the pizzas

PHP:
SpriteItem anchovies = Inventory.getItems("Anchovies").first();
SpriteItem pizza = Inventory.getItems("Plain pizza").first();
anchovies.interact("Use");

Execution.delay(300, 500);

pizza.click();

Execution.delayUntil(() -> Interfaces.getLoaded(Interfaces.getTextEqualsFilter("Anchovy pizza")).first() != null, 500, 1000);

InterfaceComponent ic = Interfaces.getAt(309, 6);

if (ic != null)
    ic.click();

Execution.delayUntil(() -> Players.getLocal().getAnimationId() == -1, 500, 1000);
 
Joined
Nov 5, 2014
Messages
505
Try using interact() instead of click() as you can the force the mouse to right click the item and choose the correct option, you should also slow down the bot by adding logic so that you only delayUntil after interactions are successful, something like this:


Code:
if (ChatDialog.getOptions().isEmpty()) {
            // We don't have the option to make pizza yet
            if (anchovies != null && anchovies.interact("Use")) {
                if (pizza != null && pizza.click()) {
                    Execution.delayUntil(() -> !ChatDialog.getOptions().isEmpty(), 1000, 2500);
                }
            }
        } else {
            // The make pizza menu is likely open
            InterfaceComponent pizzaInterface = Interfaces.getAt(309, 6);
            if (pizzaInterface != null && pizzaInterface.click()) {
                Execution.delayUntil(() -> Players.getLocal().getAnimationId() == -1, 500, 1000);
            }
        }
 
Joined
Mar 22, 2015
Messages
75
Try using interact() instead of click() as you can the force the mouse to right click the item and choose the correct option, you should also slow down the bot by adding logic so that you only delayUntil after interactions are successful, something like this:


Code:
if (ChatDialog.getOptions().isEmpty()) {
            // We don't have the option to make pizza yet
            if (anchovies != null && anchovies.interact("Use")) {
                if (pizza != null && pizza.click()) {
                    Execution.delayUntil(() -> !ChatDialog.getOptions().isEmpty(), 1000, 2500);
                }
            }
        } else {
            // The make pizza menu is likely open
            InterfaceComponent pizzaInterface = Interfaces.getAt(309, 6);
            if (pizzaInterface != null && pizzaInterface.click()) {
                Execution.delayUntil(() -> Players.getLocal().getAnimationId() == -1, 500, 1000);
            }
        }
Thanks but ChatDialog.getOptions().isEmpty() seems to always be true. Is there a method that I could use to replace this?
 
The only thing Alpha about me is my bots
Joined
Sep 22, 2014
Messages
618
Check if the interface you're trying to access != null and isVisible(). If that returns true, then you know it's visible. If either of those return false, then you know it's not there yet, so you need to interact with your pizza and anchovies.

tl;'dr: There's no logic there. It's just a list of things to do which will fire every so often.

And @Arbiter why is this shit so borked? http://vgy.me/vQvqf6.png (the layout)
 
Joined
Mar 22, 2015
Messages
75
Check if the interface you're trying to access != null and isVisible(). If that returns true, then you know it's visible. If either of those return false, then you know it's not there yet, so you need to interact with your pizza and anchovies.

tl;'dr: There's no logic there. It's just a list of things to do which will fire every 300ms.

And @Arbiter why is this shit so borked? http://vgy.me/vQvqf6.png (the layout)

Here's the method I ended up using
Code:
private boolean hasPizzaBox() {
        return Interfaces.getAt(309, 6) != null && Interfaces.getAt(309, 6).isVisible();
    }
 
The only thing Alpha about me is my bots
Joined
Sep 22, 2014
Messages
618
I don't see why you need to make it into another method? Are you calling it more than once?
 
Joined
Mar 22, 2015
Messages
75
I don't see why you need to make it into another method? Are you calling it more than once?
Calling it in two places.
In the first if statement (to check if I need to click the anchovies or if I need to click the interface) and also in the Execution.delayUntil
 
Top