Advertisement
mart3323

MKB - SlayerMarth's request pt. 1

Sep 14th, 2016
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ╒═══════════════════════════════════════════════════════════════════════════════════════════════════════╕
  2. │ Configuration                                                                                         │
  3. ╞══════════════════════════════════════╦════════════════════════════════════════════════════════════════╡
  4. │;                                     ║                                                                │
  5. │;                                     ║ # Coordinates of chests to collect iron from                   │
  6. │;     UnSet(#y[]);                    ║                                                                │
  7. │;     UnSet(#x[]);                    ║                                                                │
  8. │;     #x[] = 0;  #y[] = 90;           ║                                                                │
  9. │;     #x[] = 0;  #y[] = 50;           ║                                                                │
  10. │;     #x[] = 0;  #y[] = 40;           ║                                                                │
  11. │;     #x[] = 0;  #y[] = 0;            ║                                                                │
  12. │;     #x[] = 0;  #y[] = 320;          ║                                                                │
  13. │;     #x[] = 0;  #y[] = 310;          ║                                                                │
  14. │;     #x[] = 0;  #y[] = 270;          ║                                                                │
  15. │;                                     ║                                                                │
  16. │;     #chest_open_fail_timeout = 60;  ║ # Timeout before abort if a chest fails to open                │
  17. │;                                     ║   (in ticks (1/20'th of a second))                             │
  18. │;                                     ║                                                                │
  19. │;     #command_timeout = 60;          ║ # Timeout before abort if inventory remains full               │
  20. │;                                     ║   after calling /block and /pv1 (in ticks (1/20 of a second))  │
  21. │;                                     ║                                                                │
  22. └──────────────────────────────────────╨────────────────────────────────────────────────────────────────┘
  23.  
  24. ╒══════════════════════════════════════════════╕
  25. │  Toggle guard                                │
  26. ╞══════════════════════════════════════════════╡
  27. │; IF(automine);                               │
  28. │;     log("&5[Macro] &7AutoBlocker Disabled");│
  29. │;     unset(automine);                        │
  30. │;     stop;                                   │
  31. │; ENDIF;                                      │
  32. │; log("&5[Macro] &7AutoBlocker Enabled");     │
  33. │; set(automine);                              │
  34. └──────────────────────────────────────────────┘
  35.  
  36. ╒══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╕
  37. │     AutoBlocker script                                                                                               │
  38. ╞══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╡
  39. │                                                                                                                      │
  40. │   ╒══════════════════════════════════════════════════════════════════════════════════════════════════════════════╕   │
  41. │   │   Iron gathering                                                                                             │   │
  42. │   ╞══════════════════════════════════════════════════════════════════════════════════════════════════════════════╡   │
  43. │   │; ForEach(#y[],#y,#i);                                                                                       ;│   │
  44. │   │;   log("&5[Macro] &7AutoBlocker next chest");                                                               ;│   │
  45. │   │;   Look(%#y%,%#x[%#i%]%);                                                                                   ;│   │
  46. │   │;   Wait(2t);                                                                                                ;│   │
  47. │   │;   key(use);                                                                                                ;│   │
  48. │   │                                                                                                              │   │
  49. │   │    ╒═══════════════════════════════════════════════════════════════════╕                                     │   │
  50. │   │    │ Wait until chest opens or throw error                           ╳ │                                     │   │
  51. │   │    ╞═══════════════════════════════════════════════════════════════════╡                                     │   │
  52. │   │    │; Log("&5[Macro] &7AutoBlocker waiting for next chest");          ;│                                     │   │
  53. │   │    │; DO(%#chest_open_fail_timeout%);Until(GUI = "GUICHEST");         ;│                                     │   │
  54. │   │    │; IF(GUI != "GUICHEST");                                          ;│                                     │   │
  55. │   │    │;     Log("&5[Macro] &cAutoBlocker error: Chest was not opened"); ;│                                     │   │
  56. │   │    │;     UnSet(automine);                                            ;│                                     │   │
  57. │   │    │;     STOP;                                                       ;│                                     │   │
  58. │   │    │; ENDIF;                                                          ;│                                     │   │
  59. │   │    │;                                                                 ;│                                     │   │
  60. │   │    └───────────────────────────────────────────────────────────────────┘                                     │   │
  61. │   │;   Log("&5[Macro] &7AutoBlocker next chest");                                                               ;│   │
  62. │   │                                                                                                              │   │
  63. │   │    ╒════════════════════════════════════════════════════════════════════════════════════════════════════════╕│   │
  64. │   │    │ Collect iron (crafing if full)                                                                         ││   │
  65. │   │    ╞════════════════════════════════════════════════════════════════════════════════════════════════════════╡│   │
  66. │   │    │; #max = CONTAINERSLOTS - 37;                                                                          ;││   │
  67. │   │    │; #marker_slot = CONTAINERSLOTS - 36;                                                                  ;││   │
  68. │   │    │; For(#slot,0,%#max%);                                                                                 ;││   │
  69. │   │    │;    GetSlotItem(%#slot%,&item,#amount);                                                               ;││   │
  70. │   │    │;    IF( (&item = "iron_ingot") && (#amount = 64) );                                                   ;││   │
  71. │   │    │;        SlotClick(%#slot%,l,true);                                                                    ;││   │
  72. │   │    │;    ENDIF;                                                                                            ;││   │
  73. │   │    │;                                                                                                      ;││   │
  74. │   │    │;    GetSlotItem(%#marker_slot%,&item,#amount);                                                        ;││   │
  75. │   │    │;    IF( (&item = "iron_ingot") && (#amount = 64) );                                                   ;││   │
  76. │   │    │;                                                                                                      ;││   │
  77. │   │    │    ╒══════════════════════════════════════════════════════════════════════════════════════════════════╕││   │
  78. │   │    │    │ Craft iron into blocks                                                                         ╳ │││   │
  79. │   │    │    ╞══════════════════════════════════════════════════════════════════════════════════════════════════╡││   │
  80. │   │    │    │; # Sell                                                                                         ;│││   │
  81. │   │    │    │; Echo(/clear);                                                                                  ;│││   │
  82. │   │    │    │; Do(3);                                                                                         ;│││   │
  83. │   │    │    │;     Echo(/give %PLAYER% iron_block 64);                                                        ;│││   │
  84. │   │    │    │;     Echo(/give %PLAYER% iron_block 64);                                                        ;│││   │
  85. │   │    │    │; Loop;                                                                                          ;│││   │
  86. │   │    │    │;                                                                                                ;│││   │
  87. │   │    │    │; # Wait until sold                                                                              ;│││   │
  88. │   │    │    │; DO(%#command_timeout%);                                                                        ;│││   │
  89. │   │    │    │;     GetSlotItem(80,&item);                                                                     ;│││   │
  90. │   │    │    │; Until(&item = "air");                                                                          ;│││   │
  91. │   │    │    │;                                                                                                ;│││   │
  92. │   │    │    │; # On timeout throw error                                                                       ;│││   │
  93. │   │    │    │; IF(&item != "air");                                                                            ;│││   │
  94. │   │    │    │;     Log("&5[Macro] &cAutoBlocker error: Could not make space in inventory (could not craft?)");;│││   │
  95. │   │    │    │;     UnSet(automine);                                                                           ;│││   │
  96. │   │    │    │;     STOP;                                                                                      ;│││   │
  97. │   │    │    │;  ENDIF;                                                                                        ;│││   │
  98. │   │    │    └──────────────────────────────────────────────────────────────────────────────────────────────────┘││   │
  99. │   │    │;     ENDIF;                                                                                           ;││   │
  100. │   │    │; Next;                                                                                                ;││   │
  101. │   │    └────────────────────────────────────────────────────────────────────────────────────────────────────────┘│   │
  102. │   │;   Gui();                                                                                                   ;│   │
  103. │   │;   Log("&5[Macro] &7AutoBlocker chest done");                                                               ;│   │
  104. │   │; Next;                                                                                                      ;│   │
  105. │   └──────────────────────────────────────────────────────────────────────────────────────────────────────────────┘   │
  106. │                                                                                                                      │
  107. │                                                                                                                      │
  108. │                                                                                                                      │
  109. │   ╒══════════════════════════════════════════════════════════════════════════════════════════════════════════════╕   │
  110. │   │   Iron depositing                                                                                            │   │
  111. │   ╞══════════════════════════════════════════════════════════════════════════════════════════════════════════════╡   │
  112. │   │;  look(+0,90);                                                                                              ;│   │
  113. │   │;  key(use);                                                                                                 ;│   │
  114. │   │;  Log("&5[Macro] &7AutoBlocker depositing iron, waiting for chest open");                                   ;│   │
  115. │   │ ╒═══════════════════════════════════════════════════════════════════╕                                        │   │
  116. │   │ │   Wait until chest open or throw error                            │                                        │   │
  117. │   │ ╞═══════════════════════════════════════════════════════════════════╡                                        │   │
  118. │   │ │; DO(%#chest_open_fail_timeout%);Until(GUI = "GUICHEST");         ;│                                        │   │
  119. │   │ │; IF(GUI != "GUICHEST");                                          ;│                                        │   │
  120. │   │ │;     Log("&5[Macro] &cAutoBlocker error: Chest was not opened"); ;│                                        │   │
  121. │   │ │;     UnSet(automine);                                            ;│                                        │   │
  122. │   │ │;     STOP;                                                       ;│                                        │   │
  123. │   │ │; ENDIF;                                                          ;│                                        │   │
  124. │   │ └───────────────────────────────────────────────────────────────────┘                                        │   │
  125. │   │;  Log("&5[Macro] &7AutoBlocker chest is open, depositing");                                                 ;│   │
  126. │   │;  DO;                                                                                                       ;│   │
  127. │   │;      GetSlot(iron_block,#slot,27);                                                                         ;│   │
  128. │   │;      IF(#slot = -1);                                                                                       ;│   │
  129. │   │;          Break;                                                                                            ;│   │
  130. │   │;      ELSE;                                                                                                 ;│   │
  131. │   │;          SlotClick(%#slot%,l,true);                                                                        ;│   │
  132. │   │;      ENDIF;                                                                                                ;│   │
  133. │   │;  WHILE(GUI="GUICHEST");                                                                                    ;│   │
  134. │   │;  Gui()                                                                                                     ;│   │
  135. │   └──────────────────────────────────────────────────────────────────────────────────────────────────────────────┘   │
  136. │                                                                                                                      │
  137. └──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
  138.  
  139. ╒═══════════════════════╕
  140. │   End Guard           │
  141. ╞═══════════════════════╡
  142. │; unset(automine);    ;│
  143. └───────────────────────┘
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement