fix(webwalker): improve gate handling and path tile selection#1676
fix(webwalker): improve gate handling and path tile selection#1676mzarglis wants to merge 2 commits intochsami:developmentfrom
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the
WalkthroughThe pull request removes the deprecated Applet-based startup architecture and replaces it with direct client initialization. RuneLiteDebug is refactored to call client.initialize() instead of creating an Applet instance. MicrobotClientLoader switches from casting to Applet and calling setStub() to invoking rs.setConfiguration(). MicrobotRSAppletStub is converted from implementing AppletStub to implementing ClientConfiguration with a simplified onError() method for error handling. Additionally, Rs2Walker is enhanced with path-aware point selection for wall-distance calculations, improved door and portal traversal logic, and path progress tracking to prevent backtracking. Possibly related PRs
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In
`@runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/walker/Rs2Walker.java`:
- Around line 1208-1235: The code unconditionally advances minPathIndex even
when passedThrough is false; change the logic so minPathIndex is only updated
when the door/gate traversal was actually successful. Refactor the block around
handleDoorException(object, action), Rs2GameObject.interact(...) and the
sleepUntil(...) check to produce a boolean like doorHandled (true if
handleDoorException returned true OR if interact + sleepUntil returned
passedThrough true), log the timeout when passedThrough is false, and only
execute the minPathIndex = Math.max(minPathIndex, index + 1) and the "Door/gate
handled" debug message when doorHandled is true (use symbols:
handleDoorException, Rs2GameObject.interact, sleepUntil, passedThrough,
minPathIndex).
runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/walker/Rs2Walker.java
Show resolved
Hide resolved
d4b5de2 to
2b6e845
Compare
This commit addresses two issues i have experienced with the webwalker: 1. Reliable gate/door traversal with longer animations - Replaced simple waitForWalking() with position-based completion check - Walker now waits until player reaches destination side of gate/door - Handles any gate animation length (e.g., Gnome Fortress gates) - Prevents premature continuation that caused stuck/retry loops - Added proximity check to skip door handling if already passed through 2. Prevent off-path tile selection - Added path progress tracking (minPathIndex, lastPath) - Enhanced getPointWithWallDistance() to prefer tiles on the intended path - getClosestTileIndex() now prevents backtracking with forward bias - Walker no longer clicks tiles behind or to the side of the path - Path progress resets only when target or path changes Technical details: - Door handling now uses sleepUntil with dual conditions: reach destination or get closer to destination than start and stop moving - minPathIndex tracks committed progress through path - getPointWithWallDistance() checks path context before falling back to arbitrary adjacent tiles, scoring by distance to destination - Added pathsMatch() to detect path changes and reset progress tracking Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
When sleepUntil times out waiting for the player to pass through a door/gate, return false instead of advancing minPathIndex and reporting success. This lets the next loop iteration retry the same door. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2b6e845 to
33cc822
Compare
Summary
This PR fixes two critical issues in Rs2Walker that were causing navigation problems:
Problem 1: Gate/Door Animation Handling
Issue: The walker would try to select tiles inside gated area that are not reachable before completely through the gate causing path to be push back outside the gate. This was especially problematic the Gnome Fortress gate, causing the bot to get stuck walking back and forth through the gate repeatedly.
Root Cause:
Rs2Player.waitForWalking()only waits for the walking animation to stop, not for the player to actually reach the destination side of the gate.Solution:
waitForWalking()with position-based completion check usingsleepUntil()minPathIndexafter successfully passing through to prevent re-attempting the same doorProblem 2: Off-Path Tile Selection
Issue: The walker sometimes selected tiles behind the player or off to the side of the intended path, causing inefficient or erratic movement patterns.
Root Cause:
getPointWithWallDistance()would select any adjacent walkable tile without considering path directiongetClosestTileIndex()could select tiles behind the player's current progress, causing backtrackingSolution:
minPathIndexandlastPathstatic fieldsgetPointWithWallDistance()to accept path context and prefer tiles that are:getClosestTileIndex()to:minPathIndexonwards (with small 3-tile lookback window for recovery)minPathIndexonly when moving forwardpathsMatch()helper to detect path changes and reset progress trackingTechnical Changes
handleDoors(): Position-based gate traversal with proper completion detectiongetPointWithWallDistance(): New overload with path context, prefers on-path tilesgetClosestTileIndex(): Forward-biased tile selection with backtracking preventionminPathIndex,lastPathfor progress trackingpathsMatch()for path change detection