domp Posted August 7, 2018 Share Posted August 7, 2018 (edited) Hello World! I've run into a problem with my script not executing the walkingevent properly. Position rcarea = new Position(2701, 3719, 0); Area rcarea1 = new Area(2702, 3719, 2701, 3719); Area reset = new Area(2705, 3687, 2699, 3689); WalkingEvent walk = new WalkingEvent(rcarea); onLoop if (timer >= 250) { getWalking().walk(reset); camera.moveYaw(random(0, 360)); timer = 0L; status = "Reset aggro"; } // walkback if (reset.contains(myPosition())) { walk.setMinDistanceThreshold(0); walk.setEnergyThreshold(25); execute(walk); status = "Walking back"; } Now my problem comes into play when my player is resetting aggro and walks to the reset spot. IT works smoothly every now and then but sometimes he just sits in the reset spot and doesnt walk back to the crabs. The script is able to walk to the rockcrab area with no problem if I start in the reset area. And sometimes it works 100% smoothly. I have a status check and when my player gets stuck the status is 'Walking Back'. Is there any way to check what is actually going on and why my player wont walk back to crabs 90% of the time? IS the reset area I'm using too small? Edited August 7, 2018 by domp 1 Quote Link to comment Share on other sites More sharing options...
Lexhanatin Posted August 7, 2018 Share Posted August 7, 2018 I'm not sure why it isn't walking back. Check osbot log to see if any useful errors pop up (Settings > Toggle logger). 5 hours ago, domp said: Is there any way to check what is actually going on and why my player wont walk back to crabs 90% of the time? To debug we need to understand why the problem is occurring, rather than guessing. Try placing some log messages after each if and see what's printed in the logs during the bug. This will show where the script is stuck. if (condition 1) { log("1"); // Rest of block code } else if (condition 2) { log("2"); // Rest of block code } Let us know what you find out. Quote Link to comment Share on other sites More sharing options...
domp Posted August 8, 2018 Author Share Posted August 8, 2018 2 hours ago, d0zza said: WalkingEvents are only to be used for shorter distances and so there's a chance that a walk-able path isn't being found 90% of the time. Try use a WebWalkEvent instead and see how that goes. The problem with that is I'm afking in between two rock crabs so if my player is not in the exact position he needs to be then it won't aggro both crabs. I believe it's a default deviation of 2 so that wouldn't work. I'm going to try a different reset spot, maybe a little closer and not in all the trees and see if It runs smooth Quote Link to comment Share on other sites More sharing options...
Alek Posted August 8, 2018 Share Posted August 8, 2018 Hid all the posts that didn't answer your question and gave you alternative answers instead. The answer to your question is that when you use WalkingEvent(area), the event will try and create a path to that destination using an algorithm. However if that destination is not in a loaded region, it will fail. To overcome this, you can create a manual path: To walk to a specific position, as others have previously suggested, set the mindistancethreshold to 0. So to reiterate, it only works "sometimes" because the area you are trying to reach is only "sometimes" loaded. Quote Link to comment Share on other sites More sharing options...
domp Posted August 10, 2018 Author Share Posted August 10, 2018 (edited) @Alek Position rcarea = new Position(2701, 3719, 0); Area rcarea1 = new Area(2702, 3719, 2701, 3719); Area reset = new Area(2705, 3687, 2699, 3689); WalkingEvent walk = new WalkingEvent(rcarea); private Position[] resetpath = { new Position(2698, 3695, 0), new Position(2699, 3708, 0), new Position(2701, 3719, 0) }; // private ExperienceTracker expTracker; long timer = 0L; public long startTime = System.currentTimeMillis(); String status = "Idle"; public void onStart() throws InterruptedException { startExp = skills.getExperience(Skill.STRENGTH); if (!combat.isAutoRetaliateOn()) { combat.toggleAutoRetaliate(true); expTracker = getExperienceTracker(); } } @Override public int onLoop() throws InterruptedException { // attack if (rcarea1.contains(myPosition())) { status = "Attacking"; log("in rcarea auto-retaliating"); timer += 1L; antiban(); } // reset if (timer >= 250) { status = "Reset aggro"; log("timer hit 250, resetting aggro"); getWalking().walk(reset); camera.moveYaw(random(0, 360)); timer = 0L; } // walkback if (reset.contains(myPosition())) { status = "Walking back"; log("walking back"); getWalking().walkPath(resetpath); camera.moveYaw(random(0, 360)); } return (random(1000, 3000)); } I get an error at getWalking().walkpath(resetpath); saying the method is not applicable. Only webWalk seems to get rid of the error. EDIT: tried webWalk and it reaches final destination in the middle of the path. seems to walk to the closest position and end webwalk. Any help? Should the path have more points? They can all be seen by each other on the minimap Edited August 10, 2018 by domp Quote Link to comment Share on other sites More sharing options...
Alek Posted August 11, 2018 Share Posted August 11, 2018 ..... Please read the API: https://osbot.org/api/org/osbot/rs07/event/WalkingEvent.html Don't use web walking, go through the API, use Google to lookup errors. Also the logic is still flawed, you're only condition for walking back to an area is if some timer goes off. Quote Link to comment Share on other sites More sharing options...