Guest User

Untitled

a guest
Aug 21st, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.04 KB | None | 0 0
  1. import org.rsbot.script.Script;
  2. import org.rsbot.script.ScriptManifest;
  3. import org.rsbot.script.wrappers.RSArea;
  4. import org.rsbot.script.wrappers.RSObject;
  5. import org.rsbot.script.wrappers.RSTile;
  6.  
  7. public class wormholeWC extends Script {
  8. @ScriptManifest(authors = "wormhole95", keywords = "Woodcutting", name = "wormholeWC", version = 0.1, description = "Just a simple autocutter")
  9. final int[] hatchetID = { 1351, 1349, 1353, 1361, 1355, 1357, 1359, 6739 };
  10. final int willowLog = 13204870;
  11. final int treeID = 12432;
  12.  
  13. final RSTile[] willowsToBank = new RSTile[] { new RSTile(1234, 1234),
  14. new RSTile(1234, 1234) };
  15.  
  16. final RSTile[] bankToWillows = new RSTile[] { new RSTile(1234, 1234),
  17. new RSTile(1234, 1234) };
  18.  
  19. private boolean atBank() {
  20. RSArea area = new RSArea(new RSTile(1234, 1234), new RSTile(1234, 1234));
  21. return area.contains(getMyPlayer().getLocation());
  22. }
  23.  
  24. private boolean atTrees() {
  25. RSArea area = new RSArea(new RSTile(1234, 1234), new RSTile(1234, 1234));
  26. return area.contains(getMyPlayer().getLocation());
  27. }
  28.  
  29. private enum State {
  30. CHOP, WALKTOBANK, WALKTOTREES, BANK, SLEEP
  31. }
  32.  
  33. private State getState() {
  34.  
  35. if (getMyPlayer().getAnimation() != -1 && getMyPlayer().isIdle()) {
  36. log("State.SLEEP");
  37. return State.SLEEP;
  38. }
  39.  
  40. // Bank
  41. if (atBank()) {
  42. if (inventory.isFull()) {
  43. log("State.BANK");
  44. return State.BANK;
  45. }
  46. }
  47.  
  48. // Chop
  49. if (!inventory.isFull() && getMyPlayer().getAnimation() != -1) {
  50.  
  51. RSObject tree = objects.getNearest(treeID);
  52.  
  53. if (tree != null) {
  54.  
  55. if (atTrees()) {
  56. log("State.CHOP");
  57. return State.CHOP;
  58. }
  59.  
  60. }
  61. }
  62.  
  63. // WalkToBank
  64. if (inventory.isFull()) {
  65. if (!atBank()) {
  66. log("State.WALKTOBANK");
  67. return State.WALKTOBANK;
  68. }
  69. }
  70.  
  71. // WalkToTrees
  72. if (!inventory.isFull()) {
  73.  
  74. if (!atTrees()) {
  75. log("State.WALKTOBANK");
  76. return State.WALKTOTREES;
  77. }
  78.  
  79. }
  80.  
  81. // Sleep
  82. return State.SLEEP;
  83. }
  84.  
  85. public int loop() {
  86.  
  87. if (!game.isLoggedIn()) {
  88. return random(600, 900);
  89. }
  90.  
  91. switch (getState()) {
  92.  
  93. case BANK:
  94. if (bank.isOpen()) {
  95.  
  96. if (inventory.getCount(willowLog) > 0) {
  97. log("Depositing" + (inventory.getCount(willowLog)) + "Logs");
  98. bank.deposit(willowLog, inventory.getCount(willowLog));
  99. break;
  100. }
  101.  
  102. log("Closing Bank");
  103. bank.close();
  104. }
  105.  
  106. else {
  107. log("Opening Bank");
  108. bank.open();
  109. }
  110.  
  111. break;
  112.  
  113. case CHOP:
  114.  
  115. RSObject tree = objects.getNearest(treeID);
  116. if(tree != null) {
  117.  
  118. if (tree.isOnScreen()) {
  119. tree.doAction("Chop");
  120. }
  121.  
  122. else if (!tree.isOnScreen()) {
  123. if (random(0, 2) == 0)
  124. walking.walkTileMM(tree.getLocation());
  125. else
  126. walking.walkTileOnScreen(tree.getLocation());
  127. }
  128. }
  129. break;
  130.  
  131. case WALKTOBANK:
  132. walking.walkPathMM(willowsToBank, 3, 3);
  133. break;
  134.  
  135. case WALKTOTREES:
  136. walking.walkPathMM(bankToWillows, 3, 3);
  137. break;
  138.  
  139. case SLEEP:
  140. log("Sleep");
  141. sleep(random(300, 500));
  142. break;
  143.  
  144. }
  145.  
  146. return random(300, 500);
  147. }
  148. }
Add Comment
Please, Sign In to add comment