anfib 1 Share Posted September 8, 2022 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); } } Link to comment Share on other sites More sharing options...
Hans Zimmer 19 Share Posted September 8, 2022 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 More sharing options...
anfib 1 Author Share Posted September 8, 2022 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 More sharing options...
Hans Zimmer 19 Share Posted September 9, 2022 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. Link to comment Share on other sites More sharing options...
anfib 1 Author Share Posted September 9, 2022 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.