Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // dig.bot v1.0 Feb 17 2011
- // Digs and fills a treeplanter's pot with soil
- // ~20k per hour
- // Refills bucket from a barrel that is within 2 tiles of diggin spot
- // Doesn't eat yet
- // Start script when you are on the tile you want to dig from.
- #include <sys>
- int bar1;
- int bar1_full = 1;
- int min_stamina = 45;
- int myx;
- int myy;
- void check_soil_count() {
- if (get_count_soil() > 11) {
- if (set_inventory("Inventory")) {
- while(next_item()) {
- if (is_item_name("soil")) {
- item_click("drop");
- }
- }
- }
- if (DraggingItem) {
- drop(0);
- wait_drop();
- }
- }
- }
- int get_count_soil() {
- int count = 0;
- if (set_inventory("Inventory")) {
- while(next_item()) {
- if (is_item_name("soil")) {
- count++;
- }
- }
- }
- return count;
- }
- void process_pot() {
- int time = 0;
- if (set_inventory("Inventory")) {
- while(next_item()) {
- if (is_item_name("treeplanterspot-unsprouted")) {
- item_click("iact");
- while (!ContextMenuReady) {
- sleep(100);
- time = time + 100;
- if (time > 4000) {item_click("iact");
- time =0;
- }
- }
- select_context_menu("Empty");
- while(ContextMenuReady) sleep(100);
- //sleep(300);
- }
- }
- if (!DraggingItem) {
- reset_inventory();
- while(next_item()) {
- if (is_item_name("soil")) {
- item_click("take");
- wait_drag();
- break;
- }
- }
- }
- reset_inventory();
- while(next_item()) {
- if (is_item_name("treeplanterspot")) {
- for (int i = 0; i < 4; i++) {
- if (i < 3) item_click("itemact", 1);
- if (i == 3) item_click("itemact", 0);
- //sleep(300);
- }
- }
- }
- }
- }
- // запустить копание земли
- void start_dig() {
- if (!is_cursor("dig")) { send_action("dig"); }
- wait_dig_cursor();
- // map_click(0,0, 1,0);
- map_abs_click(myx, myy, 1, 0);
- wait_hourglass_on();
- }
- void process_earth() {
- int time = 0;
- while (1) {
- if (time > 10000) {
- break;
- }
- check_soil_count();
- if (get_count_soil() >= 4 ) {
- process_pot();
- time = 0;
- }
- check_soil_count();
- if (!HourGlass) {
- sleep(500);
- if (!HourGlass) break;
- }
- else {
- sleep(300);
- time = time + 300;
- }
- }
- }
- void drink_water() {
- int x; int y;
- int time = 0;
- if (set_inventory("Inventory")) {
- while(next_item()) {
- if (is_item_name("waterflask")) {
- if (is_item_tooltip("Empty")) {
- x = item_coord_x();
- y = item_coord_y();
- item_click("take");
- wait_drag();
- break;
- } else {
- item_click("iact");
- wait_context_menu();
- select_context_menu("Drink");
- wait_hourglass();
- return 0;
- }
- }
- }
- }
- if (bar1_full && bar1) {
- map_interact_click(bar1, 0);
- time = 0;
- while(!Moving) {
- sleep(100);
- time = time + 100;
- if (time > 1000) {
- bar1_full = 0;
- break;
- }
- }
- if (bar1_full) {
- while (1) {
- wait_end_move();
- sleep(500);
- if (!Moving) break;
- }
- item_drop_to_inventory("Inventory", x,y);
- wait_drop();
- map_abs_click(myx, myy, 1, 0);
- wait_move();
- if (set_inventory("Inventory")) {
- while(next_item()) {
- if (is_item_name("waterflask")) {
- item_click("iact");
- wait_context_menu();
- select_context_menu("Drink");
- wait_hourglass();
- return 0;
- }
- }
- }
- }
- }
- exit;
- }
- void check_stamina() {
- int bucket_x = 0;
- int bucket_y = 0;
- if (set_inventory("Inventory")) {
- while (next_item()) {
- if (is_item_name("bucket-water")) {
- bucket_x = item_coord_x();
- bucket_y = item_coord_y();
- item_click("take");
- wait_drag();
- break;
- }
- }
- reset_inventory();
- while (next_item()) {
- if (is_item_name("waterflask")) {
- item_click("itemact");
- sleep(500);
- item_drop(bucket_x,bucket_y);
- wait_drop();
- item_click("iact");
- wait_context_menu();
- select_context_menu("Drink");
- wait_hourglass();
- break;
- }
- }
- }
- while (next_item()) {
- if (is_item_name("buckete")) {
- bucket_x = item_coord_x();
- bucket_y = item_coord_y();
- item_click("take");
- wait_drag();
- // do_click(bar1, 3, 0);
- map_interact_click(bar1, 0);
- sleep(3000);
- item_drop(bucket_x, bucket_y);
- wait_drop();
- break;
- }
- }
- }
- void main() {
- if (!have_inventory("Inventory")) {
- open_inventory();
- while (!have_inventory("Inventory")) sleep(300);
- }
- myx = my_coord_x();
- myy = my_coord_y();
- bar1 = find_object_by_name("barrel", 2);
- set_show_var("bar1");
- // render_mode(0);
- while (1) {
- if (DraggingItem) {
- drop(0);
- wait_drop();
- }
- if (is_cursor("dig")) {
- map_click(0,0,3,0);
- while(!is_cursor("arw")) sleep(100);
- }
- check_soil_count();
- while (Stamina < min_stamina) check_stamina();
- if (Hungry < 25) exit;
- if (HP < 30) exit;
- start_dig();
- process_earth();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement