Advertisement
BlitzkriegScripts

[MMM] Improved Obsidian Script

Mar 10th, 2016
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.52 KB | None | 0 0
  1. $${
  2.  
  3. // Version: 1.0 - Written by MUSHKRAT / Blitzkrieg
  4. // Enjoy skidrats.
  5.  
  6. // 1. Execute all pre-mine checks (food, health, string on hotbar, pickaxe durability left, if you're in the right place, looking at the right place.)
  7. // 2. Try to eat; if no food, get more food from chest, if no food from chest, disconnect.
  8. // 3. Check for string on hotbar. If no string left, check chest. If no string from chest, disconnect.
  9. // 4. Check pickaxe durability. If <15, store in broken pickaxes chest. Look for new pickaxe in repaired pickaxe chest. If no pickaxe, disconnect.
  10. // *. Check co-ordinates against %VAR% co-ordinates
  11. // 5. If all return as a go, place string above hopper, parallel to tripwire.
  12. // 6. Turn to button, press button.
  13. // 7. Wait for (tripwire) to turn into (obsidian), and begin mining.
  14. // 8. Once (obsidian) is (air), stop mining.
  15. // 9. Repeat until disconnect.
  16.  
  17. // Completed Script: Automatically mines obsidian using this design:
  18.  
  19. // Variable Pool
  20.  
  21. #wait_1 = 200
  22. #food_yaw = 223
  23. #food_pitch = 25
  24. #obby_yaw = 361
  25. #obby_pitch = 16
  26. #string_yaw = 497
  27. #string_pitch = 43
  28. #x_start = -541
  29. #z_start = +1306
  30. #oldpick_yaw = 182
  31. #oldpick_pitch = 18
  32. #newpick_yaw = 182
  33. #newpick_pitch = 2
  34. #button_yaw = 409
  35. #button_pitch = 9
  36.  
  37. #look_timer = 1
  38.  
  39. // Main Set.
  40.  
  41. do;
  42.  
  43. // Makes sure you're in place (sanity check)
  44.  
  45. if((%XPOS% != %#x_start%) || (%ZPOS% != %#z_start%));
  46. log("not in place. stopping.");
  47. stop;
  48. endif;
  49.  
  50. // Eats food if you need it.
  51.  
  52. if(%HUNGER% < 8);
  53. pick(baked_potato);
  54.  
  55. // Checks if you have food, if not, gets it.
  56.  
  57. if(%ITEM% != "baked_potato");
  58.  
  59. // Finds food chest and open it, then grabs some food.
  60.  
  61. look(%#food_yaw%,%#food_pitch%,%#look_timer%);
  62. wait(%#wait_1%ms);
  63. key(use);
  64. wait(%#wait_1%ms);
  65. getslot(baked_potato,#cp);
  66. slotclick(%#cp%,l,true);
  67. wait(%#wait_1%ms);
  68. press(escape);
  69.  
  70. // If you're out of food, it disconnects you.
  71.  
  72. pick(baked_potato);
  73.  
  74. if(%ITEM% != "baked_potato");
  75. log("no food left");
  76. disconnect();
  77. endif;
  78.  
  79. // Ends the "find food" set.
  80.  
  81. endif;
  82.  
  83. // Eats the food you found. Resets aim to neutral to avoid opening chest.
  84.  
  85. look(%#obby_yaw%,%#obby_pitch%,%#look_timer%);
  86.  
  87. do;
  88. key(use);
  89. until(%HUNGER% > 9);
  90.  
  91. // Completes the pre-set hunger check.
  92.  
  93. endif;
  94.  
  95. // Checks pickaxe durability. If too low, puts pickaxe in broken chest, retrieves new one.
  96.  
  97. pick(diamond_pickaxe);
  98. wait(%#wait_1%ms);
  99.  
  100. if(%DURABILITY% < 10);
  101.  
  102. // Finds broken picks chest and places it inside.
  103.  
  104. look(%#oldpick_yaw%,%#oldpick_pitch%,%#look_timer%);
  105. wait(%#wait_1%ms);
  106. key(use);
  107. wait(%#wait_1%ms);
  108. getslot(diamond_pickaxe,#olddiamondpick,44);
  109.  
  110. // DE-BUG: If doesn't work, try reverse (44).
  111.  
  112. slotclick(%#olddiamondpick%,l,true);
  113. wait(%#wait_1%ms);
  114. press(escape);
  115.  
  116. look(%#obby_yaw%,%#obby_pitch%,%#look_timer%);
  117.  
  118. // Finds new pickaxe to use.
  119.  
  120.  
  121. look(%#newpick_yaw%,%#newpick_pitch%,%#look_timer%);
  122. wait(%#wait_1%ms);
  123. key(use);
  124. wait(%#wait_1%ms);
  125. getslot(diamond_pickaxe,#newdiamondpick);
  126. slotclick(%#newdiamondpick%,l,true);
  127. wait(%#wait_1%ms);
  128. press(escape);
  129.  
  130.  
  131. // If you're out of pickaxes, it disconnects you.
  132.  
  133. pick(diamond_pickaxe);
  134. wait(%#wait_1%ms);
  135.  
  136. if(%ITEM% != "diamond_pickaxe");
  137. log("no picks left");
  138. disconnect();
  139. endif;
  140.  
  141. // Completes pre-set pick check.
  142.  
  143. endif;
  144.  
  145. // All is good, placing string.
  146.  
  147. look(%#obby_yaw%,%#obby_pitch%,%#look_timer%);
  148. pick(string);
  149.  
  150. // Checks if you have string, if not, gets it.
  151.  
  152. if(%ITEM% != "string");
  153.  
  154. // Finds string chest and open it, then grabs some string.
  155.  
  156. look(%#string_yaw%,%#string_pitch%,%#look_timer%);
  157. wait(500ms);
  158. key(use);
  159. wait(500ms);
  160. getslot(string,#string);
  161. slotclick(%#string%,l,true);
  162. wait(500ms);
  163. press(escape);
  164.  
  165. // If you're out of string, it disconnects you.
  166.  
  167. pick(string);
  168. look(%#obby_yaw%,%#obby_pitch%,%#look_timer%);
  169. wait(%#wait_1%ms);
  170.  
  171. if(%ITEM% != "string");
  172. log("no string left");
  173. disconnect();
  174. endif;
  175.  
  176. // Completes the pre-set string check.
  177.  
  178. endif;
  179.  
  180. // Resets aim to neutral.
  181.  
  182. key(use);
  183.  
  184. // Placed string, activating machine.
  185.  
  186. look(%#button_yaw%,%#button_pitch%,%#look_timer%);
  187. key(use);
  188.  
  189. // Return to neutral.
  190.  
  191. look(%#obby_yaw%,%#obby_pitch%,%#look_timer%);
  192.  
  193. // Waits for the tripwire to turn into obsidian.
  194.  
  195. do;
  196. getidrel(0,0,-3,&air);
  197. until(%&air% != "tripwire");
  198.  
  199. // Starts mining the obsidian.
  200.  
  201. log("mining obsidian");
  202. pick(diamond_pickaxe);
  203. do;
  204. getidrel(0,0,-3,&id);
  205. key(attack);
  206. until(%&id% = "air");
  207.  
  208. // Mines the obsidian, increases counter by 1.
  209.  
  210. inc(#obbymined,1);
  211. log("mined obsidian", %#obbymined%);
  212.  
  213. // Completes the script. Repeats it.
  214.  
  215. loop;
  216.  
  217. }$$
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement