Advertisement
Guest User

Fruity Zulrah Source

a guest
Mar 16th, 2017
802
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.78 KB | None | 0 0
  1. package WoodCut;
  2.  
  3. import org.osbot.rs07.api.map.Area;
  4. import org.osbot.rs07.api.model.RS2Object;
  5. import org.osbot.rs07.script.Script;
  6. import org.osbot.rs07.script.ScriptManifest;
  7.  
  8.  
  9. @ScriptManifest(name = "Basic Woodcutter", author = "Joey", version = 1, info = "Cuts wood", logo = "")
  10.  
  11. public class Main extends Script {
  12.  
  13. private State state;
  14.  
  15. //Create your are for where to woodcut
  16. Area WC = new Area (0,0,0,0);
  17.  
  18. //Create your are for your bank
  19. Area Bank = new Area(0,0,0,0);
  20.  
  21.  
  22. private enum State {
  23. //These are what must be true and it will go to the case
  24. Woodcut,WalkToBank,Bank,WalkToWoodcut
  25. }
  26.  
  27. private State getState() {
  28. //This is where you tell it which case to go to. If true it will go to that case
  29.  
  30. if (getInventory().isFull() && Bank.contains(myPlayer())) {
  31. return state.Bank;
  32. }
  33.  
  34. if (getInventory().isFull() && !Bank.contains(myPlayer())) {
  35. return state.WalkToBank;
  36. }
  37.  
  38. if (!getInventory().isFull() && WC.contains(myPlayer())) {
  39. return state.Woodcut;
  40. }
  41.  
  42. if (!getInventory().isFull() && !WC.contains(myPlayer())) {
  43. return state.WalkToWoodcut;
  44. }
  45.  
  46. return state.Bank;
  47. }
  48.  
  49. public void onStart() {
  50. //Dont worry about onStart
  51. }
  52.  
  53.  
  54. @Override
  55. public int onLoop() throws InterruptedException {
  56. state = getState();
  57.  
  58. switch (state) {
  59.  
  60.  
  61. case Bank:
  62. //Basically you're saying if the bank isn't open, go open it.
  63. if (!getBank().isOpen()) {
  64. getBank().open();
  65. } else {
  66. //Now you're saying if the bank is open, deposit everything you have
  67. getBank().depositAll();
  68. }
  69.  
  70. case WalkToBank:
  71. //Basic webWalking to the bank. Will handle any obstacle in the way
  72. getWalking().webWalk(Bank);
  73.  
  74. break;
  75.  
  76. case Woodcut:
  77.  
  78. if (myPlayer().isAnimating()) {
  79. //You're saying if my player is woodcutting, to do nothing
  80. //Do nothing
  81. } else {
  82.  
  83. //Here you are null checking the tree. Once it is not equal to null, you can chop. It will only do this when it is not already chopping
  84. RS2Object tree = getObjects().closest("Tree");
  85. if (tree != null) {
  86. tree.interact("Chop");
  87. }
  88. }
  89.  
  90. break;
  91.  
  92. case WalkToWoodcut:
  93.  
  94. //Basic webWalk to the area you created for chopping.
  95.  
  96. getWalking().webWalk(WC);
  97.  
  98. break;
  99. }
  100.  
  101. //This is how long it takes to loop
  102. return random(150, 175);
  103. }
  104.  
  105. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement