NoLifeLogo1 0 Posted November 7, 2020 I am having a problem with this script and I am wondering if someone could help me. what is happening is. I am using the if (!getLocalPlayer().isMoving()) to trigger walking back to the trees. until the location contains the local player. What is happening by using this is every time I move to another tree it triggers the (!getLocalPlayer().isMoving()) and moves the player back to the Location I run back to from the bank. I am trying to find a better way to trigger the If statement to start the process of running back to the trees. I am new so if there is any other advice someone could let me know it would be appreciated. @Override public int onLoop() { GameObject Tree = null; if (getInventory().isFull()) { getWalking().walk(Banking.getRandomTile()); if (getInventory().isFull() && Banking.contains(getLocalPlayer())) getBank().open(); sleep(300, 500); getBank().depositAll("Yew logs"); sleep(300, 500); getBank().close(); } else if (!getLocalPlayer().isMoving()) { getWalking().walk(Cutting.getRandomTile()); sleepUntil(() -> Cutting.contains(getLocalPlayer()), 5000); } else { Tree = getGameObjects().closest("Yew"); if (Tree != null) { Tree.interact("Chop down"); sleep(800, 5000); sleepUntil(() -> !getLocalPlayer().isAnimating(), 50000); } } return 300; }
Pseudo 179 Posted November 7, 2020 With all due respect, not aiming to be a jack ass, you should look in to basic java usage and order of operations brother, the logic is scuffed and understandably not working for that exact reason.
Pixel_Life 24 Posted November 8, 2020 Also if you're writing a script today, you should be using the DB3 static API. DB2 is going offline in March. See https://dreambot.org/guides/scripter-guide/script-dev/upgrading-to-db3/
Recommended Posts
Archived
This topic is now archived and is closed to further replies.