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

WebWalking some how stops.

Discussion in 'Developer Support' started by Geashaw, Mar 1, 2015.

  1. Geashaw

    Joined:
    Jan 8, 2015
    Messages:
    1,429
    Likes Received:
    252
    The code I used is the following;

    Code (Java):
    1. public static boolean walkToArea(final Area area) {
    2.     final Coordinate destination = area.getRandomCoordinate();
    3.     final WebPath path = Traversal.getDefaultWeb().getPathBuilder().buildTo(destination);
    4.     return path != null && path.step(true);
    5. }
    Code (Java):
    1. @Override
    2. public boolean validate() {
    3.     return Inventory.isFull() || Inventory.isEmpty();
    4. }
    5.  
    6. @Override
    7. public void execute() {
    8.     if (Methods.atBank()) {
    9.         if (Inventory.isFull()) {
    10.             if (!Bank.isOpen()) {
    11.                 Bank.open();
    12.             } else {
    13.                 clickDepositAllButton();
    14.             }
    15.         } else {
    16.             if (Bank.isOpen()) {
    17.                 Bank.close();
    18.             } else {
    19.                 walkToMiningSpot();
    20.             }
    21.         }
    22.     } else if (Methods.atMiningSpot()) {
    23.         if (Inventory.isFull()) {
    24.             walkToBank();
    25.         }
    26.     } else {
    27.         if (Inventory.isFull()) {
    28.             walkToBank();
    29.         } else {
    30.             walkToMiningSpot();
    31.         }
    32.     }
    33. }
    34.  
    35. private boolean clickDepositAllButton() {
    36.     InterfaceComponent button = Interfaces.getAt(12, 25);
    37.  
    38.     if (button != null) {
    39.         if (button.isValid() && button.isVisible()) {
    40.             LazyAIOMiner.status = "Depositing items";
    41.             if (button.click()) {
    42.                 Execution.delayUntil(() - > Inventory.isEmpty(), 1000, 1500);
    43.                 return true;
    44.             }
    45.         }
    46.     }
    47.     return false;
    48. }
    49.  
    50. private boolean walkToBank() {
    51.     LazyAIOMiner.status = "Walking to bank";
    52.     return Methods.walkToArea(LazyAIOMiner.bankArea);
    53.  
    54.     /*Coordinate location = LazyAIOMiner.bankArea.getRandomCoordinate();
    55.         WebPath bankPath = Traversal.getDefaultWeb().getPathBuilder().buildTo(location);
    56.  
    57.         if (bankPath != null) {
    58.             LazyAIOMiner.status = "Walking to bank";
    59.             return bankPath.step();
    60.         }
    61.  
    62.         return false;*/
    63. }
    64.  
    65. private boolean walkToMiningSpot() {
    66.     LazyAIOMiner.status = "Walking to mining spot";
    67.     return Methods.walkToArea(LazyAIOMiner.mineArea);
    68.  
    69.     /*Coordinate location = LazyAIOMiner.mineArea.getRandomCoordinate();
    70.         WebPath minePath = Traversal.getDefaultWeb().getPathBuilder().buildTo(location);
    71.  
    72.         if (minePath != null) {
    73.             LazyAIOMiner.status = "Walking to mining spot";
    74.             return minePath.step();
    75.         }
    76.  
    77.         return false;*/
    78. }
    79.  
    Any ideas where it can go wrong?

     
  2. SlashnHax

    Joined:
    Dec 10, 2014
    Messages:
    3,198
    Likes Received:
    1,041
    What was the bug in the video? It seemed to walk to the bank fine, and it ended too quick for me to actually see what happened when walking to the mine :/
     
  3. Geashaw

    Joined:
    Jan 8, 2015
    Messages:
    1,429
    Likes Received:
    252
    That's where the script bot stopped walking. It will just stand there and not walk to the mine :(
     
  4. SlashnHax

    Joined:
    Dec 10, 2014
    Messages:
    3,198
    Likes Received:
    1,041
    Very strange indeed D:
     
  5. PhaseCoder

    Joined:
    Jan 1, 2015
    Messages:
    272
    Likes Received:
    26
    why use clickDepositButton?

    Bank#depositInventory() does exact same thing
     
  6. SlashnHax

    Joined:
    Dec 10, 2014
    Messages:
    3,198
    Likes Received:
    1,041
    It's possible that he codes by breaking every action into a method stub, creates the logic flow, then fills the stubs afterwards.
     
  7. Geashaw

    Joined:
    Jan 8, 2015
    Messages:
    1,429
    Likes Received:
    252
    Yep, that's how I usually code it, though the clickDepositButton was done by hand because I did not know there already was one.
     

Share This Page

Loading...