Guest User

simplebot

a guest
Aug 24th, 2013
536
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.46 KB | None | 0 0
  1. import java.awt.event.*;
  2. import java.awt.*;
  3. import java.io.BufferedReader;
  4. import java.io.IOException;
  5. import java.io.InputStreamReader;
  6.  
  7. public class simplebot {
  8. public static int constx = 1180; //CHANGE// - X coordinate of your top left berry
  9. public static int consty = 653; //CHANGE// - Y coordinate of your top left berry
  10.  
  11. public static void main(String[] args) throws AWTException {
  12.  
  13. int runTimes = 1;
  14. Robot r = new Robot();
  15. BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
  16.  
  17. System.out
  18. .println("Times to run (always goes once, so enter 0 for one run)");
  19. try {
  20. runTimes = Integer.parseInt(br.readLine());
  21. } catch (IOException e) {
  22. e.printStackTrace();
  23. }
  24.  
  25. System.out.println("Type 1 when ready to run " + runTimes + " times");
  26. String runBot = null;
  27. try {
  28. runBot = br.readLine();
  29. } catch (IOException e) {
  30. e.printStackTrace();
  31. }
  32.  
  33. if (Integer.parseInt(runBot) == 1) {
  34. doWork(runTimes, r);
  35. } else
  36. System.out.println("NOPE" + runBot);
  37. }
  38.  
  39. public static void doWork(int runTimes, Robot r) {
  40. r.delay(2000);
  41. for (int i = 0; i <= runTimes; i++) {
  42. for (int y = 0; y < 2; y++) { //change the 2 to how many rows of berries you have
  43. for (int x = 0; x < 9; x++) { //change the 9 to how many collums in your bags
  44. r.mouseMove(constx + x * 38, consty + y * 38); //38 pixels is the distance between each item in my bags
  45. r.delay(70);
  46. r.mousePress(InputEvent.BUTTON3_MASK);
  47. r.delay(20);
  48. r.mouseRelease(InputEvent.BUTTON3_MASK);
  49. r.delay(20);
  50. }
  51. }
  52. }
  53.  
  54. //uncomment if you want it to split your stacks of berries
  55. /*for (int i = 0; i <= runTimes; i++) {
  56. for (int y = 0; y < 7; y++) { //change the 7 to how many rows of berries you have
  57. for (int x = 0; x < 9; x++) { //change the 9 to how many collums in your bags
  58. r.mouseMove(constx, consty);
  59. r.delay(5);
  60. r.keyPress(KeyEvent.VK_SHIFT);
  61. r.delay(5);
  62. r.mousePress(InputEvent.BUTTON1_MASK);
  63. r.delay(20);
  64. r.mouseRelease(InputEvent.BUTTON1_MASK);
  65. r.delay(5);
  66. r.keyRelease(KeyEvent.VK_SHIFT);
  67. r.delay(5);
  68. r.keyPress(KeyEvent.VK_H);
  69. r.delay(5);
  70. r.mouseMove(constx + (x) * 38, consty + y * 38);
  71. r.delay(20);
  72. r.keyRelease(KeyEvent.VK_H);
  73. r.delay(700);
  74. r.mousePress(InputEvent.BUTTON1_MASK);
  75. r.delay(20);
  76. r.mouseRelease(InputEvent.BUTTON1_MASK);
  77. r.delay(800);
  78. }
  79. }
  80. }*/
  81. }
  82. }
Advertisement
Add Comment
Please, Sign In to add comment