Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • Help with movement


    anfib

    Recommended Posts

    So, I'm a bit confused, how do you make a bot move from place to place? I tried making mine move from the bank in lumbridge to the cow area but it just keeps climbing down and up at the stairs. Eventually it goes back to the bank for some reason(???)

    this is what i'm using:
     

    public void pathToBank(){
        if(!LUMBRIDGE_AREA.contains(getLocalPlayer())) {
            Walking.walk(LUMBRIDGE_AREA.getRandomTile());
            sleepUntil(() -> LUMBRIDGE_AREA.contains(getLocalPlayer()), 2000);
        }
    }
    public void pathToCow(){
        if(!COW_AREA.contains(getLocalPlayer())) {
            Walking.walk(COW_AREA.getRandomTile());
            sleepUntil(() -> COW_AREA.contains(getLocalPlayer()), 2000);
        }
    }
    Edited by anfib
    Link to comment
    Share on other sites

    • anfib changed the title to Help with movement

    I believe you are calling pathToBank() and pathToCow() at the same time. This would explain the climbing up and down and walking to bank sometimes.
    We would need to see further code to fully understand whats going on.

    Link to comment
    Share on other sites

    2 hours ago, Hans Zimmer said:

    I believe you are calling pathToBank() and pathToCow() at the same time. This would explain the climbing up and down and walking to bank sometimes.
    We would need to see further code to fully understand whats going on.

    Oh yeah, I think it's calling literally all the functions at the same time because it's not accounting for travel time
    I'm used to the epicbot api which automatically accounts for travel time, how do i do that here?

    Link to comment
    Share on other sites

    5 hours ago, anfib said:

    Oh yeah, I think it's calling literally all the functions at the same time because it's not accounting for travel time
    I'm used to the epicbot api which automatically accounts for travel time, how do i do that here?

    You need to do define your conditions better. You need to call walkToBank() only when out of food And walkToCow() when your inventory is full of food (for example). 

    This is what I would do.

    if(!InventoryHasFood){
        if(Walking.shouldWalk(5)) { // Returns whether you should walk - if you're moving, it'll check if your distance to destination is less than specified                  
            Walking.walk(LUMBRIDGE_AREA);
        }
    }
    
    if(Inventory.isFull()){
        if(Walking.shouldWalk(5)) {
            Walking.walk(COW_AREA);
        }
    }

    My example is very simple and you really should put more conditions for your scripts. For example, what would happen if we just banked for food, but somehow we dropped or ate one piece of food. The inventory is no longer full but it is not out of food. This will not trigger any of our two existing conditions, and the bot will not do anything.

    But... I get your point for the Walking part. I'm aware other botting platforms has Walking methods that will only break/finish when you reach the destination, but that's not how Dreambot API does it.

     

     

     

    Edited by Hans Zimmer
    Link to comment
    Share on other sites

    1 hour ago, Hans Zimmer said:

    You need to do define your conditions better. You need to call walkToBank() only when out of food And walkToCow() when your inventory is full of food (for example). 

    This is what I would do.

    if(!InventoryHasFood){
        if(Walking.shouldWalk(5)) { // Returns whether you should walk - if you're moving, it'll check if your distance to destination is less than specified                  
            Walking.walk(LUMBRIDGE_AREA);
        }
    }
    
    if(Inventory.isFull()){
        if(Walking.shouldWalk(5)) {
            Walking.walk(COW_AREA);
        }
    }

    My example is very simple and you really should put more conditions for your scripts. For example, what would happen if we just banked for food, but somehow we dropped or ate one piece of food. The inventory is no longer full but it is not out of food. This will not trigger any of our two existing conditions, and the bot will not do anything.

    But... I get your point for the Walking part. I'm aware other botting platforms has Walking methods that will only break/finish when you reach the destination, but that's not how Dreambot API does it.

     

     

     

    Thanks, I'll try to add put more conditions and see if it works!

    Link to comment
    Share on other sites

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.