Advertisement
hlprimm

Untitled

Aug 19th, 2015
270
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.18 KB | None | 0 0
  1. //This script should harvest and plant wheat in a rectangular farm, throwing
  2. //out extra seeds, and chesting wheat on one side and continuing to plant afterwards. -Gerbil_9
  3.  
  4. //Skrongden script
  5.  
  6. // Stick in first slot, food in 2nd slot, seeds in 8th and last slots.
  7. // The ONLY THINGS you should need to change are the #rows in your farm, the far-end x-coordinate (eastward)
  8. // and the #ticks to wait (near the end of the entire script).
  9. // Everything else should work as long as there's a chest
  10. // to the west of the start point, your farm faces east and you followed the other instructions.
  11.  
  12. //This if/else statement makes this script "toggle" on or off.
  13. if(wheat);
  14. log("&3Wheat Farming Stopped");
  15. unset(wheat);
  16. stop();
  17. else;
  18. log("&3Wheat Farming Started");
  19. set(wheat);
  20.  
  21. //"If not "NOT FARMING" then do the farming script, beginning here:"
  22.  
  23. do;
  24. //Set this # (currently 54) to number of rows in your farm
  25. // 6024 is what I use for farend
  26. set(#rows,62);
  27. set(#farend,-2205);
  28. set(#counter,%ZPOS%);
  29. set(#z,%ZPOS%);
  30. set(#x,%XPOS%);
  31.  
  32. //Go through this script for as many rows as you have
  33. do(%#rows%);
  34.  
  35. //Looks at inventory to see if a good amount has been filled.
  36. //If so, returns to start, dumps things in chest, returns to
  37. //where it left off.
  38. press(e);
  39. wait(250ms);
  40. getslotitem(26,&item,#num);
  41.  
  42. if(%&item% != "air");
  43. press(e);
  44. wait(250ms);
  45. wait(100ms);
  46.  
  47. look(180,0);
  48.  
  49. wait(100ms);
  50. togglekey(forward);
  51.  
  52. do;
  53. look(180,0);
  54. until(ZPOS=%#z%);
  55.  
  56. togglekey(forward);
  57. log("&3Returned to Start");
  58.  
  59. wait(250ms);
  60.  
  61. //Begin chest-placement of wheat. Starting with looking eye-level.
  62. look(270,0);
  63. wait(150ms);
  64. look(270,+45)
  65. wait(250ms);
  66. set(#chest_counter,53);
  67. key(use);
  68. wait(500ms);
  69.  
  70. do;
  71.  
  72. getslotitem(%#chest_counter%,&item,#num);
  73. if(%&item% = "wheat");
  74. slotclick(%#chest_counter%,1,true);
  75. wait(500ms);
  76. endif;
  77.  
  78. inc(#chest_counter);
  79. until(#chest_counter = 90);
  80.  
  81. press(e);
  82. look(270,-45);
  83. wait(250ms);
  84.  
  85. // This code is for wheat bots which require dumping seeds.
  86. do(9);
  87.  
  88. set(#slot,3);
  89. press(e);
  90. wait(200ms)
  91. set(#invslot,9);
  92. do;
  93. slotclick(%#invslot%,1,true);
  94. inc(#invslot);
  95. until(#invslot=35);
  96. slotclick(35,1,true);
  97. wait(250ms);
  98. press(e);
  99. //echo("Pressed E twice");
  100. wait(250ms);
  101.  
  102. do;
  103. slot(%#slot%);
  104. getslotitem(%#slot%,&item,#num);
  105.  
  106. do(%#num%);
  107.  
  108. key(drop);
  109. wait(20ms);
  110.  
  111. loop;
  112.  
  113. inc(#slot);
  114. until(#slot=8);
  115.  
  116. wait(500ms);
  117.  
  118. loop;
  119.  
  120. look(0,0);
  121. wait(100ms);
  122.  
  123. togglekey(forward);
  124. log("&3Returning to harvest");
  125.  
  126.  
  127. do;
  128. look(0,0);
  129. until(ZPOS=%#counter%);
  130.  
  131. togglekey(forward);
  132. wait(250ms);
  133.  
  134. look(90,90);
  135. press(e);
  136. wait(250ms);
  137. endif;
  138. press(e);
  139. log("&3If Statement Ended");
  140. wait(250ms);
  141.  
  142. togglekey(forward);
  143.  
  144. do;
  145. //Selects first slot (stick)
  146. slot(1);
  147. //Looks east
  148. look(90,90);
  149. //Harvests
  150. key(attack);
  151.  
  152. //set this number to the x position of the far end of your farm
  153. until(XPOS=%#farend%);
  154.  
  155. log("&3Done Harvesting");
  156. do;
  157.  
  158. //does the same as the harvesting bit, but with planting/west
  159. pick(wheat_seeds);
  160. look(270,90);
  161. key(use);
  162.  
  163. until(XPOS=%#x%);
  164. log("&3Done Planting");
  165.  
  166. //decreases row counter and starts harvesting/planting next row
  167. //togglekey(forward);
  168. dec(#counter);
  169.  
  170. //Moves to the next row.
  171. do;
  172.  
  173. look(0,0);
  174.  
  175. until(ZPOS=%#counter%);
  176. log("&3Moved to Next Row!")
  177.  
  178. //ends the harvesting/planting "do" loop
  179. loop;
  180.  
  181. do;
  182.  
  183. look(180,0);
  184.  
  185. until(ZPOS=%#z%);
  186.  
  187. togglekey(forward);
  188.  
  189. //Eating Script
  190. slot(2);
  191. keydown(use);wait(10000ms);
  192.  
  193. look(270,0);
  194. togglekey(forward);
  195.  
  196. //change this wait time to crop growth time (72000ticks*hours), I have this set currently to
  197. //a couple of seconds because I like to turn my bot off instead of letting it repeat every 3 hours
  198. //until I shut it off. Regardless, after this time has past it will start harvesting your wheat
  199. //field all over again ad infinitum.
  200.  
  201. //For "ticks" do "wait(####t);" the "t" means ticks. ms is milliseconds.
  202. wait(5000ms);
  203.  
  204. //End auto-eating script
  205. keyup(use);
  206. togglekey(forward);
  207.  
  208. wait(300ms);
  209.  
  210. //do;
  211.  
  212. //keydown(forward);
  213. //look(0,0);
  214.  
  215. //until(ZPOS=%#z%);
  216.  
  217. log("&3Done with final Forward Loop");
  218.  
  219. keyup(forward);
  220.  
  221. loop;
  222.  
  223. //end script/if-statement/loop
  224. endif;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement