SpriteItem#isHovered and SpriteItem#hover returns true if the Mouse is inside the slot bounds but not item bounds
name: Bug report
about: Report a bug in the RuneMate API
Describe the bug When manually hovering over the item you can see that there are edges of the slots interaction bounds that don't site inside the item's interaction bounds. As such when calling .isHovered or .hover on a SpriteItem can return true when it's not technically true. This is a rare bug but when the path generator does eventually hit this sweet-spot it essentially stops the entire bot if you don't have a failsafe for it.
Affected game modes: OSRS
RuneMate version: 2.107.1.
To Reproduce Steps to reproduce the behaviour:
- Write a simple snippet to find an item, hover it, then select it.
- Every so often it will "hover" the item but be unable to select it as the right-click menu can't be opened from the mouses position.
Please include the code used to produce this bug.
val antifire = Inventory.newQuery().names(antifirePattern).results().sortByIndex().first() if (antifire != null) { if ((antifire .isHovered || Mouse.move(antifire )) && antifire.interact("Drink")) { session.logger.info("Drinking ${antifire.name()}") Execution.delayUntil({ session.antifireTimer.getRuntime(TimeUnit.SECONDS) < 10 }, 1200, 1800) } }
Expected behaviour .isHovered and .hover should return true only when the Mouse is within the items bounds e.g. when item context is displayed in the top-left corner of the screen.
Screenshots N/A.
Additional context I fix this problem by shrinking the items InteractableRectangle.
val antifire = Inventory.newQuery().names(antifirePattern).results().sortByIndex().first() if (antifire != null) { val bounds = antifire.bounds?.shrink() ?: return if ((bounds.isHovered || TurboMouse.move(bounds, 10.0)) && antifire.interact("Drink")) { session.logger.info("Drinking ${antifire.name()}") Execution.delayUntil({ session.antifireTimer.getRuntime(TimeUnit.SECONDS) < 10 }, 1200, 1800) } }
fun Rectangle.shrink(): InteractableRectangle { return InteractableRectangle(this.x + 4, this.y + 4, this.width - 4, this.height - 4) }