Chuppa 2 Share Posted May 1, 2020 Hey folks, I've been making a rock mining script and it works okay, but one thing I'd like to implement is hovering over the next available rock to mine. Here's the relevant code: public static final Filter<GameObject> ORE_FILTER = GameObject -> GameObject != null //filters out the wrong stuff public static final Filter<GameObject> NEXT_ORE_FILTER = GameObject -> GameObject != null //filters out the wrong stuff and finds the next rock with distance to character > 1 (as to not select the rock that i am already mining) && GameObject.distance() > 1; if(!getInventory().isFull()) { GameObject ORE = getGameObjects().closest(ORE_FILTER); int miningxp = getSkills().getExperience(Skill.MINING); if (ORE != null) { if(ORE.interact("Mine")) { sleepUntil(() -> miningxp != getSkills().getExperience(Skill.MINING), 7000); } } ^^ is basically how it currently looks which works fine but doesn't hover if(!getInventory().isFull()) { GameObject ORE = getGameObjects().closest(ORE_FILTER); int miningxp = getSkills().getExperience(Skill.MINING); if (ORE != null) { GameObject NEXT_ORE = getGameObjects().closest(NEXT_ORE_FILTER); getMouse().drag(NEXT_ORE); if(ORE.interact("Mine")) { sleepUntil(() -> miningxp != getSkills().getExperience(Skill.MINING), 7000); } } ^^ I've tried that solution which does hover the mouse over the next rock however when it clicks the next ore it seems to double click? Any ideas on how to solve this situation? Cheers Link to comment Share on other sites More sharing options...
Chuppa 2 Author Share Posted May 1, 2020 Does this forum not allow for editing my old posts? I just noticed that I've managed to fuck the indentation while copy-pasting, whoops. Link to comment Share on other sites More sharing options...
Chuppa 2 Author Share Posted May 1, 2020 Alright I solved the problem, it seems drag is a bit buggy and for some reason does a click when it starts which is not noted in API. Fortunately move() seems to work, I'll add the working code below: GameObject ORE = getGameObjects().closest(ORE_FILTER); int miningxp = getSkills().getExperience(Skill.MINING); if (ORE != null) { if(ORE.interact("Mine")) { sleepUntil(() -> getLocalPlayer().isAnimating(), 5000); GameObject NEXT_ORE = getGameObjects().closest(NEXT_ORE_FILTER); if(getMouse().move(NEXT_ORE)) { sleepUntil(() -> miningxp != getSkills().getExperience(Skill.MINING), 7000); } } } Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.