Skip to content

Comments

Frostyrc break + startup fixes#1461

Merged
gmason0 merged 7 commits intochsami:developmentfrom
Netoxique:frostyrc_break-fixes
Sep 3, 2025
Merged

Frostyrc break + startup fixes#1461
gmason0 merged 7 commits intochsami:developmentfrom
Netoxique:frostyrc_break-fixes

Conversation

@Netoxique
Copy link
Contributor

@Netoxique Netoxique commented Sep 2, 2025

  • Repairs pouches before checking pouch contents prevents script from not starting if starting with degraded pouch.
  • Added check to main loop to pause execution whenever a break is scheduled, immediately stopping script when break is detected.
  • Close bank if somehow bank is open when teleporting.
  • Removed break inside bank logic, prevents many things from breaking while setting up.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 2, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

  • RcPlugin: Updated public static version string from v1.1.0 to v1.1.2.
  • RcScript: Added a private shouldPauseForBreak() and invoked it after super.run() to gate loop iteration on break state. In handleBanking(), moved degraded pouch repair (Rs2Magic.repairPouchesWithLunar) immediately after switching to inventory and added early returns when BreakHandlerScript indicates an active or imminent break; also ensures lock state is cleared before returning. In handleWrathWalking(), added a pre-check to close the bank (Rs2Bank.closeBank) before myth cape interactions. No public API signatures changed.

Possibly related PRs

  • Frostyrc fixes #1429: Adjusts RcScript’s run, banking, break handling, and wrath-walking logic with overlapping control-flow changes.

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between a878a4e and 462bbc8.

📒 Files selected for processing (2)
  • runelite-client/src/main/java/net/runelite/client/plugins/microbot/frosty/frostyrc/RcPlugin.java (1 hunks)
  • runelite-client/src/main/java/net/runelite/client/plugins/microbot/frosty/frostyrc/RcScript.java (5 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-08-25T07:26:53.623Z
Learnt from: Voxsylvae
PR: chsami/Microbot#1415
File: runelite-client/src/main/java/net/runelite/client/plugins/microbot/pluginscheduler/SchedulerPlugin.java:2341-2366
Timestamp: 2025-08-25T07:26:53.623Z
Learning: In SchedulerPlugin.startLoginMonitoringThread(), do not gate startup on isBreakHandlerEnabled(); rely on isOnBreak() to suppress the monitor only when a break is actually active. This avoids blocking login monitoring whenever BreakHandler is merely enabled.

Applied to files:

  • runelite-client/src/main/java/net/runelite/client/plugins/microbot/frosty/frostyrc/RcScript.java
🧬 Code graph analysis (1)
runelite-client/src/main/java/net/runelite/client/plugins/microbot/frosty/frostyrc/RcScript.java (2)
runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/inventory/Rs2Inventory.java (1)
  • Rs2Inventory (60-2244)
runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/magic/Rs2Magic.java (1)
  • Rs2Magic (44-608)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Build
🔇 Additional comments (5)
runelite-client/src/main/java/net/runelite/client/plugins/microbot/frosty/frostyrc/RcPlugin.java (1)

60-60: Version bump looks good.
Public version updated to v1.1.2 matches PR scope. No further changes in this file.

runelite-client/src/main/java/net/runelite/client/plugins/microbot/frosty/frostyrc/RcScript.java (4)

218-223: Good: unlock before honoring break state.
Clearing lock before returning on active/imminent break avoids deadlocking the BreakHandler.


488-491: Statue teleport block is fine.
Guarding against animation before interacting is reasonable; downstream checks gate progress.


743-747: LGTM: unlocking after crafting.
Releasing the lock at the end of crafting aligns with the break-pause semantics.


773-797: Teleport ordering/refill hook looks correct.
Prioritizing Ferox when refilling and triggering handleFeroxRunEnergy() immediately is consistent with the PR goals.

Comment on lines +104 to 105
if (shouldPauseForBreak()) return;
long startTime = System.currentTimeMillis();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Break pause without unlocking can stall BreakHandler.
If a break becomes active mid-loop, returning early here won’t release the BreakHandler lock unless breakIn <= 0. If the lock was set to true in a prior step, BreakHandler may be blocked. Fix in shouldPauseForBreak() to always unlock on any pause condition. See suggested diff below.

🤖 Prompt for AI Agents
In
runelite-client/src/main/java/net/runelite/client/plugins/microbot/frosty/frostyrc/RcScript.java
around lines 104-105, returning early when shouldPauseForBreak() is true can
leave the BreakHandler lock held and stall the handler; update
shouldPauseForBreak() (or the caller) so that any pause path explicitly
releases/unlocks the BreakHandler before returning—e.g., ensure
BreakHandler.unlock() is invoked on every pause condition (use a finally or
explicit unlock before return) so the lock is never left set when pausing.

Comment on lines +164 to +179
private boolean shouldPauseForBreak() {
if (!plugin.isBreakHandlerEnabled()) {
return false;
}

if (BreakHandlerScript.isBreakActive()) {
return true;
}

if (BreakHandlerScript.breakIn <= 0) {
BreakHandlerScript.setLockState(false);
return true;
}

return false;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Always clear BreakHandler lock when pausing.
When isBreakActive() is true you return without calling setLockState(false), potentially preventing BreakHandler from taking over. Unlock for both active and imminent breaks.

Apply:

 private boolean shouldPauseForBreak() {
     if (!plugin.isBreakHandlerEnabled()) {
         return false;
     }

-    if (BreakHandlerScript.isBreakActive()) {
-        return true;
-    }
+    if (BreakHandlerScript.isBreakActive()) {
+        BreakHandlerScript.setLockState(false);
+        return true;
+    }

     if (BreakHandlerScript.breakIn <= 0) {
         BreakHandlerScript.setLockState(false);
         return true;
     }

     return false;
 }
🤖 Prompt for AI Agents
In
runelite-client/src/main/java/net/runelite/client/plugins/microbot/frosty/frostyrc/RcScript.java
around lines 164 to 179, when BreakHandlerScript.isBreakActive() returns true
the method returns without clearing the BreakHandler lock; modify the method so
it calls BreakHandlerScript.setLockState(false) before returning true for both
the active-break branch and the breakIn <= 0 branch (i.e., ensure the lock is
released in both cases), keeping the existing checks and return values
otherwise.

Comment on lines +199 to +204
if (Rs2Inventory.hasDegradedPouch()) {
Rs2Magic.repairPouchesWithLunar();
sleepGaussian(900, 200);
return;
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Repairing pouches while bank UI is open can fail; close and wait first.
Casting/contact dialogues often fail with bank open. Also, only early-return if repair succeeded; otherwise fall through to normal banking.

Apply:

-        if (Rs2Inventory.hasDegradedPouch()) {
-            Rs2Magic.repairPouchesWithLunar();
-            sleepGaussian(900, 200);
-            return;
-        }
+        if (Rs2Inventory.hasDegradedPouch()) {
+            if (Rs2Bank.isOpen()) {
+                Rs2Bank.closeBank();
+                sleepUntil(() -> !Rs2Bank.isOpen(), 1200);
+            }
+            if (Rs2Magic.repairPouchesWithLunar()) {
+                sleepGaussian(900, 200);
+                return;
+            }
+            // If repair failed, continue with banking logic this tick.
+        }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (Rs2Inventory.hasDegradedPouch()) {
Rs2Magic.repairPouchesWithLunar();
sleepGaussian(900, 200);
return;
}
if (Rs2Inventory.hasDegradedPouch()) {
if (Rs2Bank.isOpen()) {
Rs2Bank.closeBank();
sleepUntil(() -> !Rs2Bank.isOpen(), 1200);
}
if (Rs2Magic.repairPouchesWithLunar()) {
sleepGaussian(900, 200);
return;
}
// If repair failed, continue with banking logic this tick.
}
🤖 Prompt for AI Agents
In
runelite-client/src/main/java/net/runelite/client/plugins/microbot/frosty/frostyrc/RcScript.java
around lines 199-204, closing the bank UI and waiting before attempting to
repair pouches is required and the method should only early-return if the repair
actually succeeded; modify the block to first close the bank if it's open (and
wait until it's closed), sleep briefly to ensure dialogs can be opened, then
call Rs2Magic.repairPouchesWithLunar(); after the repair attempt, verify success
by checking that Rs2Inventory.hasDegradedPouch() is now false and only then
sleepGaussian(900, 200) and return; if the pouch still degrades, fall through to
normal banking logic so the rest of the method can handle it.

Comment on lines +480 to +481
if (Rs2Bank.isOpen()) { Rs2Bank.closeBank(); }

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Ensure bank is fully closed before myth cape interactions.
Without a wait, item interactions can be flaky if the bank overlay lingers a tick.

Apply:

-        if (Rs2Bank.isOpen()) { Rs2Bank.closeBank(); }
+        if (Rs2Bank.isOpen()) {
+            Rs2Bank.closeBank();
+            sleepUntil(() -> !Rs2Bank.isOpen(), 1200);
+        }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (Rs2Bank.isOpen()) { Rs2Bank.closeBank(); }
if (Rs2Bank.isOpen()) {
Rs2Bank.closeBank();
sleepUntil(() -> !Rs2Bank.isOpen(), 1200);
}
🤖 Prompt for AI Agents
In
runelite-client/src/main/java/net/runelite/client/plugins/microbot/frosty/frostyrc/RcScript.java
around lines 480-481, the code closes the bank but does not wait for the bank
overlay to fully disappear, causing flaky item interactions; modify the logic to
close the bank and then wait until Rs2Bank.isOpen() returns false (or until a
short timeout, e.g., 500ms) before proceeding with myth cape interactions so the
overlay is fully gone and subsequent clicks are reliable.

@gmason0 gmason0 merged commit 0b26cdd into chsami:development Sep 3, 2025
2 checks passed
@chsami chsami mentioned this pull request Sep 3, 2025
@Netoxique Netoxique deleted the frostyrc_break-fixes branch September 6, 2025 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants