Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

Sign up now!

OSRS Sheep Shearer bot

Joined
Aug 29, 2018
Messages
1
Anyone have one?


I have old code from one before maybe someone can work off of it


-------------------------------------------------------------------------------------------------


  1. public void onStart() {
  2. if(!getInventory().contains(1735)){
  3. log("SCRIPT STOPPED: YOU NEED SHEARS IN INVENTORY!!");
  4. stop();
  5. }
  6. // new Tile(3212, 3258, 0),new Tile(3193, 3276, 0)
  7. sheepArea = new Area(new Tile(3194, 3258, 0), new Tile(3212, 3274, 0));
  8. state = State.SHEARING;
  9. inventorySize = getInventory().count(1737);
  10. startTime = System.currentTimeMillis();
  11. }

  12. public enum State {
  13. SHEARING, WALKTOBANK, WALKTOSHEEP, WAITING, BANK, OPENGATE;
  14. }

  15. public void onExit() {
  16. log("Goodbye scrub shearers");
  17. }

  18. @Override
  19. public int onLoop() {
  20. int timeout = 0;
  21. switch (state) {
  22. case SHEARING:
  23. NPC sheep = getNpcs().closest(2794, 2801, 2800, 2795, 2796, 2802);
  24. // System.out.println((sheepArea.contains(sheepPos)));
  25. inventorySize = getInventory().count(1737);
  26. if (sheepArea.contains(sheep)) {
  27. sheep.interact("Shear");
  28. } else {
  29. List<NPC> sheeps = new ArrayList<NPC>();
  30. sheeps.addAll(getNpcs().all(2794, 2801, 2800, 2795, 2796, 2802));
  31. boolean found = false;
  32. for (NPC n : sheeps) {
  33. if (sheepArea.contains(n) && !found) {
  34. n.interact("Shear");
  35. found = true;
  36. }
  37. }
  38. }
  39. state = State.WAITING;
  40. break;
  41. case WAITING:
  42. int newInv = getInventory().count(1737);
  43. if (getInventory().isFull()) {
  44. state = State.WALKTOBANK;
  45. } else if (newInv > inventorySize) {
  46. state = State.SHEARING;

  47. } else if (!getLocalPlayer().isMoving()) {
  48. sleep(Calculations.random(300, 400));
  49. if (!getLocalPlayer().isMoving())
  50. state = State.SHEARING;
  51. }
  52. break;
  53. case WALKTOBANK:

  54. getWalking().walk(new Tile(3209, 3261, 0));
  55. do {
  56. sleep(Calculations.random(400, 600));
  57. } while (getWalking().getDestinationDistance() > 2);
  58. GameObject[] gateZone = getGameObjects().getObjectsOnTile(
  59. new Tile(3213, 3262));
  60. GameObject gate = null;
  61. for (GameObject g : gateZone) {
  62. if (g.getID() == 12987 || g.getID() == 12986)
  63. gate = g;
  64. }
  65. if (gate != null)
  66. gate.interact("Open");
  67. do {
  68. timeout++;
  69. if (timeout > 4) {
  70. gate.interact("Open");
  71. timeout = 0;
  72. }
  73. sleep(Calculations.random(500, 600));
  74. } while (getGameObjects().closest(12989, 12988) == null);

  75. getWalking().walk(new Tile(3216, 3261, 0));
  76. sleep(Calculations.random(500, 600));
  77. do {
  78. timeout++;
  79. if (timeout > 4) {
  80. getWalking().walk(new Tile(3216, 3261, 0));
  81. timeout = 0;
  82. }
  83. sleep(Calculations.random(500, 600));
  84. } while (getWalking().getDestinationDistance() > 2);

  85. getWalking().walk(new Tile(3216, 3254, 0));
  86. sleep(Calculations.random(500, 600));
  87. do {
  88. timeout++;
  89. if (timeout > 4) {
  90. getWalking().walk(new Tile(3216, 3254, 0));
  91. timeout = 0;
  92. }
  93. sleep(Calculations.random(500, 600));
  94. } while (getWalking().getDestinationDistance() > 2);

  95. getWalking().walk(new Tile(3219, 3246, 0));
  96. sleep(Calculations.random(500, 600));
  97. do {
  98. timeout++;
  99. if (timeout > 4) {
  100. getWalking().walk(new Tile(3219, 3246, 0));
  101. timeout = 0;
  102. }
  103. sleep(Calculations.random(500, 600));
  104. } while (getWalking().getDestinationDistance() > 2);

  105. getWalking().walk(new Tile(3224, 3237, 0));
  106. sleep(Calculations.random(500, 600));
  107. do {
  108. timeout++;
  109. if (timeout > 4) {
  110. getWalking().walk(new Tile(3224, 3237, 0));
  111. timeout = 0;
  112. }
  113. sleep(Calculations.random(500, 600));
  114. } while (getWalking().getDestinationDistance() > 2);

  115. getWalking().walk(new Tile(3231, 3231, 0));
  116. sleep(Calculations.random(500, 600));
  117. do {
  118. timeout++;
  119. if (timeout > 4) {
  120. getWalking().walk(new Tile(3231, 3231, 0));
  121. timeout = 0;
  122. }
  123. sleep(Calculations.random(500, 600));
  124. } while (getWalking().getDestinationDistance() > 2);

  125. getWalking().walk(new Tile(3231, 3231, 0));
  126. sleep(Calculations.random(500, 600));
  127. do {
  128. timeout++;
  129. if (timeout > 4) {
  130. getWalking().walk(new Tile(3231, 3231, 0));
  131. timeout = 0;
  132. }
  133. sleep(Calculations.random(500, 600));
  134. } while (getWalking().getDestinationDistance() > 2);

  135. getWalking().walk(new Tile(3224, 3218, 0));
  136. sleep(Calculations.random(500, 600));
  137. do {
  138. timeout++;
  139. if (timeout > 4) {
  140. getWalking().walk(new Tile(3224, 3218, 0));
  141. timeout = 0;
  142. }
  143. sleep(Calculations.random(500, 600));
  144. } while (getWalking().getDestinationDistance() > 2);

  145. getWalking().walk(new Tile(3217, 3218, 0));
  146. sleep(Calculations.random(500, 600));
  147. do {
  148. timeout++;
  149. if (timeout > 4) {
  150. getWalking().walk(new Tile(3217, 3218, 0));
  151. timeout = 0;
  152. }
  153. sleep(Calculations.random(500, 600));
  154. } while (getLocalPlayer().isMoving());

  155. getWalking().walk(new Tile(3215, 3210, 0));
  156. sleep(Calculations.random(500, 600));
  157. do {
  158. timeout++;
  159. if (timeout > 4) {
  160. getWalking().walk(new Tile(3215, 3210, 0));
  161. timeout = 0;
  162. }
  163. sleep(Calculations.random(500, 600));
  164. } while (getLocalPlayer().isMoving());

  165. getWalking().walk(new Tile(3207, 3209, 0));
  166. sleep(Calculations.random(500, 600));
  167. do {
  168. timeout++;
  169. if (timeout > 4) {
  170. getWalking().walk(new Tile(3210, 3211, 0));
  171. timeout = 0;
  172. }
  173. sleep(Calculations.random(500, 600));
  174. } while (getLocalPlayer().isMoving());

  175. GameObject stairs = getGameObjects().closest(16671);
  176. stairs.interact("Climb-up");
  177. do {
  178. timeout++;
  179. if (timeout > 4) {
  180. stairs.interact("Climb-up");
  181. timeout = 0;
  182. }
  183. sleep(Calculations.random(500, 600));
  184. } while (getGameObjects().closest(16672) == null);
  185. sleep(Calculations.random(500, 600));
  186. stairs = getGameObjects().closest(16672);
  187. stairs.interact("Climb-up");
  188. do {
  189. timeout++;
  190. if (timeout > 4) {
  191. stairs.interact("Climb-up");
  192. timeout = 0;
  193. }
  194. sleep(Calculations.random(500, 600));
  195. } while (getGameObjects().closest(16673) == null);
  196. getWalking().walk(new Tile(3208, 3219, 2));
  197. sleep(Calculations.random(500, 600));
  198. do {
  199. timeout++;
  200. if (timeout > 4) {
  201. getWalking().walk(new Tile(3208, 3219, 2));
  202. timeout = 0;
  203. }
  204. } while (getWalking().getDestinationDistance() > 2);
  205. sleep(Calculations.random(500, 600));
  206. state = State.BANK;
  207. break;
  208. case BANK:
  209. woolAmount = woolAmount + getInventory().count(1737);
  210. log("Wool gathered: \t" + woolAmount);
  211. long profit = woolAmount * woolPrice;
  212. log("Proft: \t" + profit);
  213. long currentTime = System.currentTimeMillis();
  214. long timeTaken = currentTime - startTime;
  215. timeTaken = (timeTaken / (1000 * 60)) % 60;
  216. log("Time taken: \t" + timeTaken + " minutes");
  217. getBank().open();
  218. sleep(Calculations.random(800, 1000));

  219. do {
  220. sleep(Calculations.random(800, 1000));
  221. getBank().open();
  222. } while (!getBank().isOpen());
  223. getBank().depositAll(1737);
  224. do {
  225. sleep(Calculations.random(800, 1000));
  226. getBank().depositAll(1737);
  227. } while (getInventory().contains(1737));
  228. sleep(Calculations.random(500, 600));
  229. getBank().close();
  230. state = State.WALKTOSHEEP;
  231. break;
  232. case WALKTOSHEEP:
  233. GameObject[] stairsZone = getGameObjects().getObjectsOnTile(
  234. new Tile(3205, 3208, 2));
  235. GameObject stairs2 = null;
  236. for (GameObject g : stairsZone) {
  237. if (g != null)
  238. if (g.getID() == 16673)
  239. stairs2 = g;
  240. }
  241. if (stairs2 != null)
  242. stairs2.interact("Climb-down");
  243. timeout = 0;
  244. do {
  245. timeout++;
  246. if (timeout > 4) {
  247. stairs2.interact("Climb-down");
  248. timeout = 0;
  249. }
  250. sleep(Calculations.random(500, 600));
  251. } while (getGameObjects().closest(16672) == null);

  252. stairs2 = getGameObjects().closest(16672);
  253. stairs2.interact("Climb-down");
  254. do {
  255. timeout++;
  256. if (timeout > 4) {
  257. stairs2.interact("Climb-down");
  258. timeout = 0;
  259. }
  260. sleep(Calculations.random(500, 600));
  261. } while (getGameObjects().closest(16671) == null);

  262. getWalking().walk(new Tile(3207, 3209, 0));
  263. do {
  264. timeout++;
  265. if (timeout > 4) {
  266. getWalking().walk(new Tile(3207, 3209, 0));
  267. timeout = 0;
  268. }
  269. sleep(Calculations.random(500, 600));
  270. } while (getWalking().getDestinationDistance() > 2);

  271. getWalking().walk(new Tile(3215, 3210, 0));
  272. do {
  273. timeout++;
  274. if (timeout > 4) {
  275. getWalking().walk(new Tile(3215, 3210, 0));
  276. timeout = 0;
  277. }
  278. sleep(Calculations.random(500, 600));
  279. } while (getWalking().getDestinationDistance() > 2);

  280. getWalking().walk(new Tile(3217, 3218, 0));
  281. do {
  282. timeout++;
  283. if (timeout > 4) {
  284. getWalking().walk(new Tile(3217, 3218, 0));
  285. timeout = 0;
  286. }
  287. sleep(Calculations.random(500, 600));
  288. } while (getWalking().getDestinationDistance() > 2);

  289. getWalking().walk(new Tile(3224, 3218, 0));
  290. do {
  291. timeout++;
  292. if (timeout > 4) {
  293. getWalking().walk(new Tile(3224, 3218, 0));
  294. timeout = 0;
  295. }
  296. sleep(Calculations.random(500, 600));
  297. } while (getWalking().getDestinationDistance() > 2);

  298. getWalking().walk(new Tile(3233, 3222, 0));
  299. do {
  300. timeout++;
  301. if (timeout > 4) {
  302. getWalking().walk(new Tile(3233, 3222, 0));
  303. timeout = 0;
  304. }
  305. sleep(Calculations.random(500, 600));
  306. } while (getWalking().getDestinationDistance() > 2);

  307. getWalking().walk(new Tile(3231, 3231, 0));
  308. do {
  309. timeout++;
  310. if (timeout > 4) {
  311. getWalking().walk(new Tile(3231, 3231, 0));
  312. timeout = 0;
  313. }
  314. sleep(Calculations.random(500, 600));
  315. } while (getWalking().getDestinationDistance() > 2);

  316. getWalking().walk(new Tile(3224, 3237, 0));
  317. do {
  318. timeout++;
  319. if (timeout > 4) {
  320. getWalking().walk(new Tile(3224, 3237, 0));
  321. timeout = 0;
  322. }
  323. sleep(Calculations.random(500, 600));
  324. } while (getWalking().getDestinationDistance() > 2);

  325. getWalking().walk(new Tile(3219, 3246, 0));
  326. do {
  327. timeout++;
  328. if (timeout > 4) {
  329. getWalking().walk(new Tile(3219, 3246, 0));
  330. timeout = 0;
  331. }
  332. sleep(Calculations.random(500, 600));
  333. } while (getWalking().getDestinationDistance() > 2);

  334. getWalking().walk(new Tile(3216, 3254, 0));
  335. do {
  336. timeout++;
  337. if (timeout > 4) {
  338. getWalking().walk(new Tile(3216, 3254, 0));
  339. timeout = 0;
  340. }
  341. sleep(Calculations.random(500, 600));
  342. } while (getWalking().getDestinationDistance() > 2);
  343. getWalking().walk(new Tile(3215, 3260, 0));
  344. do {
  345. timeout++;
  346. if (timeout > 4) {
  347. getWalking().walk(new Tile(3215, 3260, 0));
  348. timeout = 0;
  349. }
  350. sleep(Calculations.random(500, 600));
  351. } while (getWalking().getDestinationDistance() > 2);

  352. GameObject[] gateZone2 = getGameObjects().getObjectsOnTile(
  353. new Tile(3213, 3262));
  354. GameObject gate2 = null;
  355. for (GameObject g : gateZone2) {
  356. if (g.getID() == 12987)
  357. gate2 = g;
  358. }
  359. if (gate2 != null)
  360. gate2.interact("Open");
  361. do {
  362. timeout++;
  363. if (timeout > 4) {
  364. if (gate2 != null)
  365. gate2.interact("Open");
  366. timeout = 0;
  367. }
  368. sleep(Calculations.random(500, 600));
  369. } while (getGameObjects().closest(12989) == null);
  370. getWalking().walk(new Tile(3208, 3261, 0));
  371. do {

  372. } while (getWalking().getDestinationDistance() > 2);
  373. state = State.SHEARING;
  374. break;
  375. default:
  376. break;

  377. }
  378. return Calculations.random(500, 600);
  379. }

  380. public void deadFunc() {
  381. GameObject stairs = getGameObjects().closest(16671);
  382. stairs.interact("Climb-up");
  383. sleep(Calculations.random(300, 400));
  384. stairs = getGameObjects().closest(16672);
  385. stairs.interact("Climb-up");
  386. sleep(Calculations.random(300, 400));
  387. getWalking().walk(new Tile(3208, 3219, 0));
  388. }
  389. }
 
Top