Question Bot fails to run to bank regardless of how I code the logic

Discussion in 'Developer Support' started by supadupap00p, May 11, 2021.

  1. supadupap00p

    Joined:
    May 7, 2021
    Messages:
    1
    Likes Received:
    0
    Hi guys, final year comp sci here, never worked with Java but thought it was a good time to start.

    Anyway my bot has like 16 Class files so its not feasible to post them all here for help.

    It is just meant to be a basic wood cutting bot (west varrock oaks and then banking).

    Anyway the problem is once the inventory is full, 60%-70% of the time it wont run to the bank and deposit like I have intended. Sometimes it does but most times not (which is already baffling to me). Also I have used the exact same logic for it to run back to the oaks or run from somewhere nearby and that works flawlessly.

    What could be the problem here??

    Code (Text):
    1. public class TravelToBank extends LeafTask {
    2.     Coordinate pointOne = new Coordinate(3184, 3435, 0);
    3.     Coordinate pointTwo = new Coordinate(3182, 3442, 0);
    4.  
    5.     Area bankArea = new Area.Rectangular(pointOne, pointTwo);
    6.  
    7.     @Override
    8.     public void execute() {
    9.         RegionPath regionPath = RegionPath.buildTo(bankArea.getRandomCoordinate());
    10.         if(regionPath != null) {
    11.             regionPath.step();
    12.         }
    13.         else {
    14.             getLogger().warn("regionPath was null in Walk");
    15.         }
    16.     }
    17. }
     
  2. CuppaJava

    CuppaJava cuppa.drink(coffee);

    Joined:
    Mar 13, 2018
    Messages:
    2,262
    Likes Received:
    723
    @supadupap00p are you fairly certain this class is causing issue? Eg. if you put a log at the beginning of this class, this class is the one being called?
    I'm not sure if I'm missing something, but nothing is jumping out at me as clearly wrong. Do you know if regionPath is null (eg you're getting that warning log) or if regionPath.step() just isn't doing anything?
     
  3. dahnae

    Joined:
    Oct 21, 2018
    Messages:
    87
    Likes Received:
    67
    I'd like too add that RegionPath uses the current loaded region. If the bank is far away, it could sometimes not be in the loaded chunk.
     
    Hit My Gong and CuppaJava like this.

Share This Page

Loading...