1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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

Discussion in 'Developer Support' started by r0llingthund3r, Nov 16, 2017.

  1. r0llingthund3r

    Joined:
    Apr 30, 2017
    Messages:
    1
    Likes Received:
    0
    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 (Text):
    1. public class RunToAltar extends LeafTask{
    2.  
    3.     Player player;
    4.    
    5.     @Override
    6.     public void execute() {
    7.         GameObject ruins = GameObjects.newQuery().on(Constants.fireAltarRuins).names("Mysterious ruins").actions("Enter").results().first();
    8.        final WebPath path = Traversal.getDefaultWeb().getPathBuilder().buildTo(Constants.fireAltarRuins.randomize(3, 3));
    9.  
    10.         if(path != null) {
    11.             path.step();
    12.             Execution.delayUntil(() -> ruins != null, 2000, 4000);
    13.             if(ruins != null)ruins.click();
    14.         }
    15.         else System.out.println("PATH NULL");
    16.        
    17.     }
    18.  
    19. }
     
  2. auxi

    Joined:
    May 24, 2016
    Messages:
    1,113
    Likes Received:
    990
    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().
     
  3. qverkk

    Joined:
    Sep 22, 2015
    Messages:
    1,603
    Likes Received:
    381
    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
     

Share This Page

Loading...