Welcome!

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

Sign up now!

Question Traversing to, and then interacting with a game object smoothly?

Joined
Apr 30, 2017
Messages
1
I'm developing a fire rune crafter. At some point it needs to traverse from the duel arena to the fire ruins, then interact with the ruins. My bot traverses to the location, pauses for some time, then finally interacts with the ruins in a really awkward manner. Does anyone have any tips on how they would optimize this process?

Any advice or insight is greatly appreciated.

Code:
public class RunToAltar extends LeafTask{

    Player player;
   
    @Override
    public void execute() {
        GameObject ruins = GameObjects.newQuery().on(Constants.fireAltarRuins).names("Mysterious ruins").actions("Enter").results().first();
       final WebPath path = Traversal.getDefaultWeb().getPathBuilder().buildTo(Constants.fireAltarRuins.randomize(3, 3));

        if(path != null) {
            path.step();
            Execution.delayUntil(() -> ruins != null, 2000, 4000);
            if(ruins != null)ruins.click();
        }
        else System.out.println("PATH NULL");
       
    }

}
 
Joined
May 24, 2016
Messages
1,113
I would check if the ruins are non-null first and if it is interact with it, if not traverse to it. And don't use any delays after step().
 
Joined
Sep 22, 2015
Messages
1,613
As auxi said, null check the object, interact with it if it isn't null and is visible, if it isn't visible just walk to it, and if u want to prevent it from spam clicking the last coordinate u can delay untill you're like 5 steps away from the coord or something
 
Top