krock 0 Posted May 28, 2018 I'm just beginning my scripting journey here using DreamBot's API. Been coding for a while in other languages though. Searched around a lot and I really see so many different ways people walk. I wrote a simply Runecrafting script and this is how my walking logic went public int execute() { if (FireRuinsArea.contains(getLocalPlayer().getTile())) { getCamera().rotateToEntity(getGameObjects().closest("Mysterious ruins")); getGameObjects().closest("Mysterious ruins").interact("Enter"); sleepUntil(() -> FireRuinsArea.contains(getLocalPlayer().getTile()), Calculations.random(2000, 2500)); } else { if (FireAltarArea.contains(getLocalPlayer().getTile())) { if(getInventory().isFull()) { getGameObjects().closest("Altar").interact("Craft-rune"); sleepUntil(() -> getLocalPlayer().isAnimating(), Calculations.random(2000, 2500)); } else { getGameObjects().closest("Portal").interact("Use"); sleepUntil(() -> FireRuinsArea.contains(getLocalPlayer().getTile()), Calculations.random(2000, 2500)); } } else { getWalking().walk(FireRuinsArea.getRandomTile()); sleepUntil(() -> FireRuinsArea.contains(getLocalPlayer().getTile()), Calculations.random(2000, 2500)); } } return Calculations.random(900,2500); } So... this worked for me and is pretty stable. However, I always see posts regarding how amazing the webwalking capabilities are, but I just can't seem to implement it correctly. I'm working on a simple chaos druids (edgeville dungeons) script that will bank/fight/loot etc... I'm having real trouble using webwalking, and not because of the obstacles (trapdoor, gate, etc.). It simply just doesn't walk for me correctly. I am looking for a definitive usage on getWalking().walk() so I can stop fucking around with so much walking code that doesn't work. I want someone to tell me why this code doesn't work? Shouldn't just automatically walk to the destination? Or am i misunderstanding the capabilities of the web walker? Tile t = areaDruids.getRandomTile(); getWalking().walk(t); if (!sleepUntil(() -> areaDruids.contains(getLocalPlayer().getTile()), Calculations.random(2000, 2500))) { getWalking().walk(t); } I have other code that interacts with all the obstacles (trapdoor, gate, etc...) but shouldn't this _just_ work, no?
krock 0 Author Posted May 28, 2018 Also, am I using sleepUntil() correctly in either the 1st or 2nd snippet? I really just want to know how to walk correctly lol...
Milasoft 202 Posted May 28, 2018 This is how I have done it and it seems to work okay. while (!AREA.contains(getLocalPlayer())) { getWalking().walk(AREA.getRandomTile()); sleepUntil(() -> !getLocalPlayer().isMoving(), 5200); }
krock 0 Author Posted May 28, 2018 1 hour ago, Milasoft said: This is how I have done it and it seems to work okay. while (!AREA.contains(getLocalPlayer())) { getWalking().walk(AREA.getRandomTile()); sleepUntil(() -> !getLocalPlayer().isMoving(), 5200); } Yeah this only works after I am halfway to the druids. After the trapdoor, and past the 1st gate. Hmm. Thanks
Nima 92 Posted May 28, 2018 The webwalker doesn't work in certain areas of the map since they don't have nodes. This is also the case for the Edgeville dungeon. You have to create your own nodes if you want to use the webwalker in the dungeon. You can achieve this easily by using Hoodz' WebTool:
Xephy 237 Featured Comment Posted May 28, 2018 The webwalker doesn't have the edgeville dungeon mapped correctly at all. You'd have to add web nodes yourself and then add them to the walker to use the same walking logic. What you're doing right now uses the web walker, but it only works with what the web walker knows exists. To see the web nodes, go to the tools -> debugging -> web nodes(or something like that). This will allow you to see what's currently mapped. Also, a side note. When interacting with something, note that it returns a boolean if the interaction succeeds or not. That means you can structure your interactions like so: if (action) { sleepUntil(() -> ); } What you may want to do with adding a custom web path is declaring and defining a CustomWebPath with tiles marked in the constructor, and then just add it to the webwalker by doing something like: getWalking().getWebPathFinder().addCustomWebPath(CustomWebPath); A helpful tool to generate what can be put in the constructor of your Custom Web Path is this (https://explv.github.io/). Just change the Position class to Tile and ta-da. You'll have something like this: CustomWebPath myPath = new CustomWebPath( new Tile(3007, 9549, 0), new Tile(2997, 9548, 0), new Tile(2994, 9555, 0), new Tile(2994, 9564, 0), new Tile(2998, 9572, 0) ); @Override public void onStart() { getWalking().getWebPathFinder().addCustomWebPath(myPath); }
Nex 2546 Featured Comment Posted May 28, 2018 if (getWalking().shouldWalk(int tiles before endgoal to click again) { getWalking().walk(destination); }
krock 0 Author Posted May 28, 2018 1 hour ago, Nex said: if (getWalking().shouldWalk(int tiles before endgoal to click again) { getWalking().walk(destination); } Nex -- when using this technique, the script will not wait until it has reached the tile to keep walking. It doesn't reach the destination and immediately skips to the next statements. This is after a single click when the target distance is still far away and the tiles before endgoal = 4.
Nex 2546 Posted May 28, 2018 3 minutes ago, krock said: if u want it to wait till it reached its destination leave the int blank, if thats what u mean
Recommended Posts
Archived
This topic is now archived and is closed to further replies.