Jump to content

TheManWhoLicks

Members
  • Posts

    8
  • Joined

  • Last visited

  • Feedback

    0%

Profile Information

  • Gender
    Male

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

TheManWhoLicks's Achievements

Newbie

Newbie (1/10)

0

Reputation

  1. Dang, I didn't realize all of that was handled. You're 100% right. I simplied it all down and no longer am having trouble walking. Thanks!!!
  2. Alright i need some help fellas. My walking file seems to be very inconsistent. webWalk usually does not work that well for example. Anyone see what I'm doing wrong? import org.osbot.rs07.api.map.Position; import org.osbot.rs07.api.map.Area; import java.util.List; import org.osbot.rs07.script.MethodProvider; public class MasterWalker extends MethodProvider { private static final int WEB_WALK_TIMEOUT = 5000; // Increased timeout for longer paths private static final int INTERACT_DISTANCE_THRESHOLD = 10; // Proximity threshold for target position private static final int MAX_REGULAR_WALK_ATTEMPTS = 3; // Max attempts for regular walking before using webWalk private static final int STEP_DIVISION_UNIT = 5; // Smaller step distances for finer control // Overloaded walkTo method that accepts a list of waypoints public boolean walkTo(Position destination, List<Position> waypoints, CheckInterrupt interrupt) throws InterruptedException { // Check if the player is already at the destination if (myPosition().equals(destination)) { log("Player is already at the destination: " + destination); return true; } for (Position waypoint : waypoints) { if (divideAndWalk(waypoint, interrupt)) { if (getWalking().webWalk(destination)) { return true; } } } log("Fallback to direct webWalk to final destination."); return webWalkWithTimeout(destination); // Fallback if waypoints don’t work } public boolean walkTo(Object destination, CheckInterrupt interrupt) throws InterruptedException { checkRunEnergy(); if (destination instanceof Position) { Position position = (Position) destination; // Check if the player is already at the position if (myPosition().equals(position)) { log("Player is already at the target position: " + position); return true; } if (canReach(position)) { log("Position is reachable via regular walk."); return divideAndWalk(position, interrupt); } else { log("Position appears unreachable via regular walk, attempting web walk as fallback."); return webWalkWithTimeout(position); } } else if (destination instanceof Area) { Area area = (Area) destination; // Check if the player is already within the area if (area.contains(myPosition())) { log("Player is already within the target area: " + area); return true; } Position randomPosition = area.getRandomPosition(); if (canReach(randomPosition)) { log("Area is reachable via regular walk."); return divideAndWalk(randomPosition, interrupt); } else { log("Area appears unreachable via regular walk, attempting web walk as fallback."); return webWalkWithTimeout(randomPosition); } } else if (destination instanceof List) { return handlePath((List<Position>) destination, interrupt); } return false; // Invalid input } private boolean divideAndWalk(Position target, CheckInterrupt interrupt) throws InterruptedException { double distance = myPosition().distance(target); int steps = (int) Math.ceil(distance / STEP_DIVISION_UNIT); log("Calculated steps to target: " + steps); Position currentPosition = myPosition(); for (int i = 0; i < steps; i++) { checkRunEnergy(); if (interrupt.shouldInterrupt()) { log("Interrupt condition met; stopping walk."); return false; } Position stepTarget = getIntermediatePosition(currentPosition, target, STEP_DIVISION_UNIT); log("Attempting regular walk to intermediate point: " + stepTarget); if (!walkToPosition(stepTarget)) { log("Failed to reach intermediate point: " + stepTarget); return false; } currentPosition = stepTarget; waitUntilStopped(3000); } log("Successfully divided and reached target position: " + target); return true; } private Position getIntermediatePosition(Position from, Position to, int stepDistance) { double distance = from.distance(to); double ratio = stepDistance / distance; int x = (int) (from.getX() + (to.getX() - from.getX()) * ratio); int y = (int) (from.getY() + (to.getY() - from.getY()) * ratio); return new Position(x, y, from.getZ()); } private boolean walkToPosition(Position position) throws InterruptedException { checkRunEnergy(); log("Attempting regular walk to: " + position); if (getWalking().walk(position)) { customSleep(5000); return true; } log("Regular walking to " + position + " failed."); return false; } private boolean webWalkWithTimeout(Position position) throws InterruptedException { long startTime = System.currentTimeMillis(); log("Attempting webWalk to position: " + position); while (System.currentTimeMillis() - startTime < WEB_WALK_TIMEOUT) { if (getWalking().webWalk(position)) { customSleep(10000); return true; } log("Attempting to reach position: " + position + " - Time elapsed: " + (System.currentTimeMillis() - startTime) + "ms"); sleep(200); } log("Web walk to position timed out after " + WEB_WALK_TIMEOUT + "ms."); return false; } private void checkRunEnergy() { if (!getSettings().isRunning() && getSettings().getRunEnergy() > 15) { getSettings().setRunning(true); log("Run energy above 15%; enabling run mode."); } } private void waitUntilStopped(int timeout) throws InterruptedException { int timeWaited = 0; while (myPlayer().isMoving() && timeWaited < timeout) { sleep(100); timeWaited += 100; } } // Utility method to simulate custom sleep private void customSleep(int timeout) throws InterruptedException { int timeWaited = 0; while (myPlayer().isMoving() && timeWaited < timeout) { sleep(100); timeWaited += 100; } } private boolean handlePath(List<Position> path, CheckInterrupt interrupt) throws InterruptedException { for (Position position : path) { checkRunEnergy(); if (interrupt.shouldInterrupt()) { log("Interrupt condition met; stopping path."); return false; } if (!walkToPosition(position)) { log("Failed to walk to position in path: " + position); return false; } waitUntilStopped(3000); } return true; } public interface CheckInterrupt { boolean shouldInterrupt(); } private boolean canReach(Position position) { return getMap().canReach(position); } private boolean canReach(Area area) { for (Position pos : area.getPositions()) { if (getMap().canReach(pos)) { return true; } } return false; } }
  3. Howdy Explv - does this walking script still work? I've been trying to develop one of my own but am having some difficulties. seems to work some of the time, othertimes it appears to ge tthe location destination way off. not sure if it has to do with the tiles/coordinates or what
  4. I appreciate the tip, though I'd like for someone to be accessible for quick questions and answers, mainly as I work through the initial setup and steps. Let me know if you are interested at all, love your work. Thanks! I'd like to learn directly with OSRS and developing a script as I go, hence looking for a tutor/mentor to jump on some calls with. I learn a lot more efficiently with someone there to ask questions as well.
  5. Howdy all, As the title says - I'm looking for somebody to be my personal scripting tutor. I want you to sit with me and guide through the entire process of scripting for OSRS. I have little to no experience with coding, nor setting up environments, etc. So we'll be starting from scratch. The code itself I plan to heavily utilize ChatGPT, however I'll need guidance on actually getting scripts writting, how to structure scripts, etc etc. Send me a PM if interested, thanks! TheManWhoLicks
  6. Howdy everyone! I used to bot OSRS back in the day, getting a few accounts nearly maxed out. Nowadays I'd like to actually learn more about programming and developing scripts myself. Could anyone point me to a course that will get me started on the basics and is geared towards applying that knowledge to scripting various bots? Any tips are appreciated!
×
×
  • Create New...