Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.22 KB | None | 0 0
  1. // dig.bot v1.0 Feb 17 2011
  2. // Digs and fills a treeplanter's pot with soil
  3. // ~20k per hour
  4. // Refills bucket from a barrel that is within 2 tiles of diggin spot
  5. // Doesn't eat yet
  6.  
  7. // Start script when you are on the tile you want to dig from.
  8.  
  9. #include <sys>
  10.  
  11. int bar1;
  12. int bar1_full = 1;
  13.  
  14. int min_stamina = 45;
  15.  
  16. int myx;
  17. int myy;
  18.  
  19. void check_soil_count() {
  20. if (get_count_soil() > 11) {
  21. if (set_inventory("Inventory")) {
  22. while(next_item()) {
  23. if (is_item_name("soil")) {
  24. item_click("drop");
  25. }
  26. }
  27. }
  28. if (DraggingItem) {
  29. drop(0);
  30. wait_drop();
  31. }
  32. }
  33. }
  34.  
  35. int get_count_soil() {
  36. int count = 0;
  37. if (set_inventory("Inventory")) {
  38. while(next_item()) {
  39. if (is_item_name("soil")) {
  40. count++;
  41. }
  42. }
  43. }
  44. return count;
  45. }
  46.  
  47. void process_pot() {
  48. int time = 0;
  49. if (set_inventory("Inventory")) {
  50. while(next_item()) {
  51. if (is_item_name("treeplanterspot-unsprouted")) {
  52. item_click("iact");
  53. while (!ContextMenuReady) {
  54. sleep(100);
  55. time = time + 100;
  56. if (time > 4000) {item_click("iact");
  57. time =0;
  58. }
  59. }
  60. select_context_menu("Empty");
  61. while(ContextMenuReady) sleep(100);
  62. //sleep(300);
  63. }
  64. }
  65.  
  66. if (!DraggingItem) {
  67. reset_inventory();
  68.  
  69. while(next_item()) {
  70. if (is_item_name("soil")) {
  71. item_click("take");
  72. wait_drag();
  73. break;
  74. }
  75. }
  76. }
  77. reset_inventory();
  78.  
  79. while(next_item()) {
  80. if (is_item_name("treeplanterspot")) {
  81.  
  82. for (int i = 0; i < 4; i++) {
  83. if (i < 3) item_click("itemact", 1);
  84. if (i == 3) item_click("itemact", 0);
  85. //sleep(300);
  86. }
  87. }
  88. }
  89. }
  90. }
  91.  
  92. // запустить копание земли
  93. void start_dig() {
  94. if (!is_cursor("dig")) { send_action("dig"); }
  95.  
  96. wait_dig_cursor();
  97.  
  98. // map_click(0,0, 1,0);
  99. map_abs_click(myx, myy, 1, 0);
  100.  
  101. wait_hourglass_on();
  102. }
  103.  
  104.  
  105. void process_earth() {
  106. int time = 0;
  107.  
  108. while (1) {
  109. if (time > 10000) {
  110. break;
  111. }
  112.  
  113. check_soil_count();
  114.  
  115. if (get_count_soil() >= 4 ) {
  116. process_pot();
  117. time = 0;
  118. }
  119.  
  120. check_soil_count();
  121.  
  122. if (!HourGlass) {
  123. sleep(500);
  124. if (!HourGlass) break;
  125. }
  126. else {
  127. sleep(300);
  128. time = time + 300;
  129. }
  130. }
  131. }
  132.  
  133.  
  134. void drink_water() {
  135. int x; int y;
  136. int time = 0;
  137.  
  138. if (set_inventory("Inventory")) {
  139. while(next_item()) {
  140. if (is_item_name("waterflask")) {
  141. if (is_item_tooltip("Empty")) {
  142. x = item_coord_x();
  143. y = item_coord_y();
  144. item_click("take");
  145. wait_drag();
  146. break;
  147. } else {
  148. item_click("iact");
  149. wait_context_menu();
  150. select_context_menu("Drink");
  151. wait_hourglass();
  152. return 0;
  153. }
  154. }
  155. }
  156. }
  157.  
  158.  
  159. if (bar1_full && bar1) {
  160. map_interact_click(bar1, 0);
  161. time = 0;
  162. while(!Moving) {
  163. sleep(100);
  164. time = time + 100;
  165. if (time > 1000) {
  166. bar1_full = 0;
  167. break;
  168. }
  169. }
  170.  
  171. if (bar1_full) {
  172. while (1) {
  173. wait_end_move();
  174. sleep(500);
  175. if (!Moving) break;
  176. }
  177. item_drop_to_inventory("Inventory", x,y);
  178.  
  179. wait_drop();
  180.  
  181. map_abs_click(myx, myy, 1, 0);
  182.  
  183. wait_move();
  184.  
  185. if (set_inventory("Inventory")) {
  186. while(next_item()) {
  187. if (is_item_name("waterflask")) {
  188. item_click("iact");
  189. wait_context_menu();
  190. select_context_menu("Drink");
  191. wait_hourglass();
  192. return 0;
  193. }
  194. }
  195. }
  196. }
  197. }
  198.  
  199. exit;
  200. }
  201.  
  202.  
  203. void check_stamina() {
  204. int bucket_x = 0;
  205. int bucket_y = 0;
  206.  
  207. if (set_inventory("Inventory")) {
  208. while (next_item()) {
  209. if (is_item_name("bucket-water")) {
  210. bucket_x = item_coord_x();
  211. bucket_y = item_coord_y();
  212.  
  213. item_click("take");
  214. wait_drag();
  215. break;
  216. }
  217. }
  218.  
  219. reset_inventory();
  220.  
  221. while (next_item()) {
  222. if (is_item_name("waterflask")) {
  223. item_click("itemact");
  224. sleep(500);
  225. item_drop(bucket_x,bucket_y);
  226. wait_drop();
  227. item_click("iact");
  228. wait_context_menu();
  229. select_context_menu("Drink");
  230. wait_hourglass();
  231. break;
  232. }
  233. }
  234. }
  235.  
  236. while (next_item()) {
  237. if (is_item_name("buckete")) {
  238. bucket_x = item_coord_x();
  239. bucket_y = item_coord_y();
  240. item_click("take");
  241. wait_drag();
  242.  
  243. // do_click(bar1, 3, 0);
  244. map_interact_click(bar1, 0);
  245. sleep(3000);
  246. item_drop(bucket_x, bucket_y);
  247. wait_drop();
  248. break;
  249. }
  250. }
  251.  
  252. }
  253.  
  254.  
  255.  
  256.  
  257.  
  258. void main() {
  259. if (!have_inventory("Inventory")) {
  260. open_inventory();
  261. while (!have_inventory("Inventory")) sleep(300);
  262. }
  263.  
  264. myx = my_coord_x();
  265. myy = my_coord_y();
  266.  
  267. bar1 = find_object_by_name("barrel", 2);
  268.  
  269. set_show_var("bar1");
  270.  
  271. // render_mode(0);
  272.  
  273. while (1) {
  274. if (DraggingItem) {
  275. drop(0);
  276. wait_drop();
  277. }
  278.  
  279. if (is_cursor("dig")) {
  280. map_click(0,0,3,0);
  281. while(!is_cursor("arw")) sleep(100);
  282. }
  283.  
  284. check_soil_count();
  285.  
  286. while (Stamina < min_stamina) check_stamina();
  287.  
  288. if (Hungry < 25) exit;
  289. if (HP < 30) exit;
  290.  
  291. start_dig();
  292. process_earth();
  293. }
  294. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement