Flexeren Posted April 28, 2016 Posted April 28, 2016 Hey there,I was wondering if it was possible to move the mouse while doing a task and waiting for it to complete.Fx while Woodcutting, it hovers the mouse on the next nearby tree, while chopping another one.Any help / tips appreciated!
Woody Posted April 28, 2016 Posted April 28, 2016 While animating -> find another nearby tree -> move mouse over the tree
GaetanoH Posted April 28, 2016 Posted April 28, 2016 (edited) You can use the .hover(); method on any Entity, something like this, you'll still have to check which tree you're interacting with... RS2Object tree = getObjects().closest("Oak"); if(!myPlayer().isAnimating()){ tree.interact("Chop down"); } else { tree.hover(); } Edited April 28, 2016 by GaetanoH
Explv Posted April 28, 2016 Posted April 28, 2016 (edited) Hey there, I was wondering if it was possible to move the mouse while doing a task and waiting for it to complete. Fx while Woodcutting, it hovers the mouse on the next nearby tree, while chopping another one. Any help / tips appreciated! Maybe something like this? Pseudo Code: If we are chopping a tree: If we have not found another tree: Find another tree Else if we are not hovering over the other tree: Hover over the other tree Else: Chop a tree import org.osbot.rs07.api.model.RS2Object; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.utility.ConditionalSleep; @ScriptManifest(author = "", name = "", info = "", version = 0.1, logo = "") public class WoodCutter extends Script { private enum State{ CHOPPING, HOVERING } private RS2Object currentTree; private RS2Object hoverTree; private State getState(){ if(currentTree != null && currentTree.exists() && myPlayer().isAnimating()) return State.HOVERING; return State.CHOPPING; } @Override public int onLoop() throws InterruptedException { switch (getState()){ case CHOPPING: chop(); break; case HOVERING: hoverNextTree(); break; } return random(200, 300); } private void chop(){ currentTree = getObjects().closest("Tree"); if(currentTree != null){ currentTree.interact("Chop down"); new ConditionalSleep(5000) { @Override public boolean condition() throws InterruptedException { return myPlayer().isAnimating(); } }.sleep(); } } private void hoverNextTree(){ if(hoverTree == null || !hoverTree.exists()) { hoverTree = getObjects().closest(obj -> obj.getName().equals("Tree") && obj != currentTree); } else if(!getMouse().isOnCursor(hoverTree)) { hoverTree.hover(); } } } You can use the .hover(); method on any Entity, something like this, you'll still have to check which tree you're interacting with... RS2Object tree = getObjects().closest("Oak"); if(!myPlayer().isAnimating()){ tree.interact("Chop down"); } else { tree.hover(); } That would only hover over the same tree that you are cutting (the closest one) Edited April 28, 2016 by Explv 1
Flexeren Posted April 29, 2016 Author Posted April 29, 2016 Thanks for the quick replies, this is surely a big help to me, thanks! I will mess around with it