Skip to content

Microbot.hopToWorld rejects valid hops due to stale Player.isInteracting() pointer #1772

@runsonmypc

Description

@runsonmypc

Summary

Microbot.hopToWorld(int) short-circuits with "Local player is interacting, cannot hop worlds" whenever LocalPlayer.isInteracting() is true. That guard is overly broad: the OSRS engine keeps the interaction pointer set for many seconds after benign actions (closing a shop, talking to an NPC, getting aggro'd), even when the world switcher would actually succeed. As a result, any plugin that interacts with an NPC and then tries to hop without first moving the player gets stuck retrying forever.

Repro

Run BanksShopperPlugin (Microbot-Hub) at the Blast Furnace, or any shop where the bot stands still after closing the trade. Configure it to hop on out-of-stock. After the first hop attempt the script tight-loops hopToWorld, all blocked by the same guard.

Diagnostic captured at the call site (player idle, no animation, shop UI already closed via Rs2Shop.closeShop()):

isInteracting=true target=Ordan/cb=0/anim=-1
selfAnim=-1 selfPose=808 gameState=LOGGED_IN isMoving=false

The OSRS server honors a hop attempt in this state — the in-game "Please finish what you are doing before using the world switcher" warning does not fire here. Only the Microbot guard rejects it.

Root cause

runelite-client/src/main/java/net/runelite/client/plugins/microbot/Microbot.java line 367:

if (Microbot.getClient().getLocalPlayer() != null
    && Microbot.getClient().getLocalPlayer().isInteracting()) {
    log.error("Local player is interacting, cannot hop worlds");
    return false;
}

Player.isInteracting() is getInteracting() != null. It stays true until the engine clears the interaction pointer (movement, new interaction, combat reset). It is not a signal that a hop will be rejected.

Proposed fix

Replace the isInteracting() check with the conditions that actually block a hop in OSRS:

  • Rs2Combat.inCombat() (active combat)
  • Rs2Shop.isOpen() / Rs2Dialogue.isInDialogue() / Rs2Bank.isOpen() (blocking widgets)

The Wilderness PvP timer is enforced by the server itself, so the existing client.hopToWorld(...) call already handles that path.

Affected plugins (Microbot-Hub)

Confirmed: BanksShopperPlugin, AutoLooterPlugin (post-PR #421 still hits it when the player has any prior actor engagement near the loot spot). Likely affects every plugin that hops after interacting with a banker or shopkeeper.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions