Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class SimplePowerChopper extends Script {
- public final String TREE = "Tree";
- private enum State {
- CHOP, DROP
- }
- private State getState() {
- if (inventory.isFull())
- return State.DROP;
- return State.CHOP;
- }
- @Override
- public void onStart() {
- log("Starting Script");
- }
- @Override
- public int onLoop() throws InterruptedException {
- switch (getState()) {
- case CHOP:
- if (!myPlayer().isAnimating()) {
- RS2Object tree = objects.closest("Tree");
- if (tree != null) {
- if (tree.interact("Chop"))
- sleep(random(1000, 1500));
- }
- }
- break;
- case DROP:
- if (inventory.isFull()) {
- inventory.dropAll();
- }
- break;
- }
- return random(200, 300);
- }
- @Override
- public void onExit() {
- log("Stopping Script");
- }
- @Override
- public void onPaint(Graphics2D g) {
- // This is the paint of the script
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment