Advertisement
Guest User

Untitled

a guest
Dec 28th, 2016
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 24.54 KB | None | 0 0
  1. program RuneSudoku;
  2. //uses SysUtils;
  3. //Change log (As of 4/3/13)
  4. // Changed counter maximum during dialog from 10 to 50. This should make it break less because of lag. Still testing this for a solution...
  5. // Changed ClickDelay back from 5 to 10. This might make it not mess up on puzzles. Again, not sure... Trying to optimize everything.
  6. // Made it so it doesn't bother trying to talk to Ali if the sudoku puzzle is still up. (This should make things a lot faster for those times that it doesn't finish by accident)
  7. // Modified the antiban so it doesn't make you randomly walk around.
  8. // Activated the antiban code.
  9. // There is now a 6% chance of antiban doing one of the random actions instead of 60%.
  10. // Added RandomBabble antiban - Says random phrases in german.
  11.  
  12. {$DEFINE SMART8}
  13. {$I SRL-OSR/SRL.Simba}
  14.  
  15. const
  16. Username = '';
  17. Password = '';
  18. buyMindRunes = false;
  19. buyDeathRunes = true;
  20. buyCosmicRunes = true;
  21. buyNatureRunes = true;
  22. buyChaosRunes = false;
  23. NumbOfPlayers = 1;
  24. ClickDelay = 10; //Delay between the input of answers
  25.  
  26. var
  27. numbstring, posfind:string;
  28. ansArray : Array[1..81] of String;
  29. stopScript, logoutTimer, count, i, v, c, z, x, y, row, col, boxrow, boxcol, buy_runes:integer;
  30.  
  31. procedure DeclarePlayers;
  32. var i, buy_runes:integer;
  33. begin
  34. NumberOfPlayers(1);
  35. CurrentPlayer := 0;
  36. for i := 0 to NumbOfPlayers-1 do
  37. Players[i].BoxRewards := ['mote', 'ostume', 'XP', 'Gem', 'ithril', 'oal', 'une', 'oins'];
  38.  
  39. with Players[0] do
  40. begin
  41. Name := Username; // Username
  42. Pass := Password; // Password
  43. Active := True;
  44. Pin := ''; // Leave blank if you have no pin.
  45. buy_runes := 0
  46. end;
  47. end;
  48. procedure RandomBabble;
  49. Var htmlSource, phrase : String;
  50. Var index, strlength, startpoint : integer;
  51. Begin
  52. Writeln('trying to get phrase...');
  53. htmlSource := GetPage('http://www.smartphrase.com/cgi-bin/randomphrase.cgi?german&humorous');
  54. Writeln('Got the html source...');
  55. index := 8473;//((Pos('<OPTION VALUE="randomphrase.cgi?german&humorous&testyourself&13&&&&&">On', htmlSource)) + length('</SELECT> <FONT SIZE=-1> <A HREF="javascript:openWin1()"> What"s This?</A></FONT> </FORM> </TD> <TD ALIGN="center" WIDTH=420 BGCOLOR="#DCDCFF">'));
  56. Writeln('Got the position... ' + inttostr(index));
  57. repeat
  58. if (htmlSource[index] = '<') then
  59. begin
  60. index := ((length(htmlSource)) + 1);
  61. end
  62. else
  63. begin
  64. phrase := phrase + htmlSource[index];
  65. index := index + 1;
  66. end;
  67. until (index > length(htmlSource));
  68. TypeSendEx(phrase, true);
  69. //SendKeys(phrase, Random(100), Random(250));
  70. //wait(Random(200));
  71. //presskey(13);
  72. //Keydown(13);
  73. //KeyUp(13);
  74. writeln(phrase);
  75. End;
  76.  
  77. Procedure Antiban;
  78. Begin
  79. Case Random(1000) Of
  80. 100: HoverSkill('random', False);
  81. 200: Begin PickUpMouse; SleepAndMoveMouse(3000 + Random(500)); End;
  82. 300: IdleTime(100+random(700), 100+Random(100), 0.2+RandomE/2);
  83. 400: Begin GameTab(Tab_Stats); Wait(3000 + Random(500)); GameTab(Tab_Inv); End;
  84. 600: BoredHuman;
  85. //700: RandomBabble;
  86. //800: RandomBabble;
  87. End;
  88. end;
  89.  
  90. procedure LogIn;
  91. var a, b, c, d:integer;
  92. Begin
  93. writeln('Attempting to log in...');
  94. if (FindColorTolerance(a, b, 6181970, 340, 220, 340, 220, 5)) then
  95. begin
  96. writeln('We have detected that we are on the log in page. Trying to log in now...');
  97. MMouse(455, 290, 5, 5);
  98. wait(100);
  99. ClickMouse2(mouse_left);
  100. wait(100 + Random(500));
  101. SendKeys(Username, 50+Random(51), 30+Random(30));
  102. wait(500 + Random(69)); //haha 69
  103. KeyDown(9); //Tab key down PressKey seems to hit the key twice sometimes so we're doing it this way even though it doesn't make sense...
  104. KeyUp(9); //Tab key up
  105. wait(1000 + Random(100));
  106. SendKeys(Password, 50+Random(51), 30+Random(30));
  107. wait(100);
  108. MMouse(304, 321, 5, 5);
  109. ClickMouse2(mouse_left);
  110. repeat
  111. wait(1000 + random(500));
  112. until FindColorTolerance(c, d, 584, 336, 316, 336, 316, 5);
  113. MMouse(398, 335, 5, 5);
  114. wait(200);
  115. ClickMouse2(mouse_left);
  116. end
  117. else
  118. begin
  119. writeln('We have detected that we are not on the login page...');
  120. writeln('If you are not already logged in please close SMART and restart the script.');
  121. end;
  122.  
  123. end;
  124. procedure CheckIfLoggedOut;
  125. Var a, b:integer;
  126. Begin
  127. if (logoutTimer < 5) then
  128. begin
  129. if (FindColorTolerance(a, b, 6181970, 340, 220, 340, 220, 5)) then
  130. begin
  131. writeln('We were logged out somehow... Logging back in.');
  132. LogIn;
  133. end;
  134. end;
  135. end;
  136. procedure TalkToAli;
  137. var
  138. counter, x, y:integer;
  139. begin
  140. writeln('starting to find ali');
  141. if FindObjCustom(x, y, ['li', 'orri'], [13818072, 5723997, 16118771], 5) then
  142. begin
  143. writeln('ali found')
  144. Wait(100+random(500));
  145. ClickMouse2(mouse_left);
  146. counter := 0;
  147. repeat
  148. counter := counter + 1;
  149. ClickToContinue;
  150. Wait(100 + Random(100)); //Added this delay because it wasn't always registering correctly
  151. until (FindNPCChatText('unes', Nothing)) or (counter > 50);
  152. wait(100 + Random(200));
  153. FindNPCChatText('unes', clickleft);
  154. ClickToContinue;
  155. counter := 0;
  156. repeat
  157. counter := counter + 1;
  158. ClickToContinue;
  159. Wait(100 + Random(100));
  160. until (FindNPCChatText('arge', Nothing)) or (counter > 50);
  161. wait(100 + Random(200));
  162. FindNPCChatText('arge', clickleft);
  163. counter := 0;
  164. repeat
  165. counter := counter + 1;
  166. ClickToContinue;
  167. Wait(100 + Random(100));
  168. until (FindNPCChatText('xamine', Nothing)) or (counter > 50);
  169. wait(100 + Random(200));
  170. FindNPCChatText('xamine', clickleft);
  171. end;
  172. end;
  173.  
  174. procedure writeAnsArray(inputString : string);
  175. begin
  176. for i:=1 to 81 do
  177. begin
  178. if not (strtoint(copy(inputString,i,1)) = 0) then
  179. begin
  180. ansArray[i] := (copy(inputString,i,1));
  181. end else
  182. begin
  183. ansArray[i] := '123456789';
  184. end;
  185. end;
  186. end;
  187.  
  188. function checkRows : boolean;
  189. begin
  190. for i:=1 to 81 do
  191. begin
  192. if (length(ansArray[i]) = 1) then //if the string length is 1, the answer is decided. need to remove the number from the row
  193. begin
  194. row := (((i-1)/9)+1); //determines the row
  195. for v:=1 to 81 do
  196. begin
  197. if (row = (((v-1)/9)+1)) then //checks if the row of boxes 1-81 matches the row of the string above ^
  198. begin
  199. if not (v = i) then //if the box is not the same box as the correct string ^
  200. begin
  201. if not ((pos(ansArray[i], ansArray[v])) = 0) then //if the string can be found in any of the strings on the same row
  202. begin
  203. //writeln(ansArray[i]+' is at box '+inttostr(i)+' and removed from box '+inttostr(v)+' because they are at the same row');
  204. delete(ansArray[v], (pos(ansArray[i], ansArray[v])), 1); //finds and removes said string from the other string
  205. result := true;
  206. end;
  207. end;
  208. end;
  209. end;
  210. end;
  211. end;
  212. end;
  213.  
  214. function checkCols: boolean;
  215. begin
  216. for i:=1 to 81 do
  217. begin
  218. if (length(ansArray[i]) = 1) then //if the string length is 1, the answer is decided. need to remove the number from the col
  219. begin
  220. col := (((i-1) mod 9)+1); //determines the col
  221. for v:=1 to 81 do
  222. begin
  223. if (col = (((v-1) mod 9)+1)) then //checks if the col of boxes 1-81 matches the col of the string above ^
  224. begin
  225. if not (v = i) then //if the box is not the same box as the correct string ^
  226. begin
  227. if not ((pos(ansArray[i], ansArray[v])) = 0) then //if the string can be found in any of the strings on the same col
  228. begin
  229. //writeln(ansArray[i]+' is at box '+inttostr(i)+' and removed from box '+inttostr(v)+' because they are at the same col');
  230. delete(ansArray[v], (pos(ansArray[i], ansArray[v])), 1); //finds and removes said string from the other string
  231. result := true;
  232. end;
  233. end;
  234. end;
  235. end;
  236. end;
  237. end;
  238. end;
  239.  
  240. function checkTbTbox : boolean;
  241. begin
  242. for i:=1 to 81 do
  243. begin
  244. if (length(ansArray[i]) = 1) then //if the string length is 1, the answer is decided. need to remove the number from the 3x3 box
  245. begin
  246. boxrow := ((((i-1)/9)/3)+1); //determines the boxrow
  247. boxcol := ((((i-1) mod 9)/3)+1); //determines the boxcol
  248. for v:=1 to 81 do
  249. begin
  250. if ((boxrow = ((((v-1)/9)/3)+1)) and (boxcol = ((((v-1) mod 9)/3)+1))) then //checks if the boxcol and boxrow match the boxcol and boxrow of the string above ^
  251. begin
  252. if not (v = i) then //if the box is not the same box as the correct string ^
  253. begin
  254. if not ((pos(ansArray[i], ansArray[v])) = 0 ) then //if the string can be found in any of the string on the same boxcol and boxrow
  255. begin
  256. //writeln(ansArray[i]+' is at box '+inttostr(i)+' and removed from box '+inttostr(v)+' because they are at the same boxcol and boxrow');
  257. delete(ansArray[v], (pos(ansArray[i], ansArray[v])), 1); //finds and removes said string from the other string
  258. result := true;
  259. end;
  260. end;
  261. end;
  262. end;
  263. end;
  264. end;
  265. end;
  266.  
  267. function solvesquares : boolean;
  268. begin
  269. if (checkRows or checkCols or checkTbTbox) then
  270. begin
  271. result := true;
  272. end;
  273. end;
  274.  
  275. function singlesRows : boolean;
  276. begin
  277. for row:=1 to 9 do //for rows 1 - 9
  278. begin
  279. for c:=1 to 9 do //for numbers 1 - 9
  280. begin
  281. z := 0;
  282. posfind := '';
  283. for v:=1 to 81 do //for boxes 1 - 81
  284. begin
  285. if (row = (((v-1)/9)+1)) then //checks if the row of boxes 1-81 matches the row above ^
  286. begin
  287. if not ((pos(inttostr(c), ansArray[v])) = 0) then //if the number is found in the box
  288. begin
  289. z := z+1; //count + 1
  290. posfind := posfind + inttostr(v); //string of box
  291. end;
  292. end;
  293. end; //if only 1 is found
  294. if ((z = 1) and not (length(ansArray[strtoint(posfind)]) = 1)) then
  295. begin
  296. ansArray[strtoint(posfind)] := inttostr(c); //replaces the string with the number
  297. result := true;
  298. end;
  299. end;
  300. end;
  301. end;
  302.  
  303. function singlesCols : boolean;
  304. begin
  305. for col:=1 to 9 do //for col 1 - 9
  306. begin
  307. for c:=1 to 9 do //for numbers 1 - 9
  308. begin
  309. z := 0;
  310. posfind := '';
  311. for v:=1 to 81 do //for boxes 1 - 81
  312. begin
  313. if (col = (((v-1) mod 9)+1)) then //checks if the row of boxes 1-81 matches the row above ^
  314. begin
  315. if not ((pos(inttostr(c), ansArray[v])) = 0) then //if the number is found in the box
  316. begin
  317. z := z+1; //count + 1
  318. posfind := posfind + inttostr(v); //string of box
  319. end;
  320. end;
  321. end; //if only 1 is found
  322. if ((z = 1) and not (length(ansArray[strtoint(posfind)]) = 1)) then
  323. begin
  324. ansArray[strtoint(posfind)] := inttostr(c); //replaces the string with the number
  325. result := true;
  326. end;
  327. end;
  328. end;
  329. end;
  330.  
  331. function singlesTbTbox : boolean;
  332. begin
  333. for boxrow:=1 to 3 do //for col 1 - 9
  334. begin
  335. for boxcol:=1 to 3 do
  336. begin
  337. for c:=1 to 9 do //for numbers 1 - 9
  338. begin
  339. z := 0;
  340. posfind := '';
  341. for v:=1 to 81 do //for boxes 1 - 81
  342. begin
  343. if (boxrow = ((((v-1)/9)/3)+1)) and (boxcol = ((((v-1) mod 9)/3)+1)) then //checks if the row of boxes 1-81 matches the row above ^
  344. begin
  345. if not ((pos(inttostr(c), ansArray[v])) = 0) then //if the number is found in the box
  346. begin
  347. z := z+1; //count + 1
  348. posfind := posfind + inttostr(v); //string of box
  349. end;
  350. end;
  351. end; //if only 1 is found
  352. if ((z = 1) and not (length(ansArray[strtoint(posfind)]) = 1)) then
  353. begin
  354. ansArray[strtoint(posfind)] := inttostr(c); //replaces the string with the number
  355. result := true;
  356. end;
  357. end;
  358. end;
  359. end;
  360. end;
  361.  
  362. function solvesingles : boolean;
  363. begin
  364. if (singlesRows or singlesCols or singlesTbTbox) then
  365. begin
  366. result := true;
  367. end;
  368. end;
  369.  
  370. procedure outputPuzzle;
  371. begin
  372. i := 1;
  373. for v:=1 to 9 do
  374. begin
  375. writeln('output puzz ['+ansArray[i]+']['+ansArray[i+1]+']['+ansArray[i+2]+']['+ansArray[i+3]+']['+ansArray[i+4]+']['+ansArray[i+5]+']['+ansArray[i+6]+']['+ansArray[i+7]+']['+ansArray[i+8]+']');
  376. i := i + 9;
  377. end;
  378. end;
  379.  
  380. procedure findAnswer;
  381. begin
  382. repeat
  383. repeat
  384. //it attempts to solve in the until
  385. until not (solvesquares);
  386. //it attempts to solve in the until
  387. until not (solvesingles);
  388. end;
  389.  
  390. procedure writeNumbstring;
  391. var
  392. x, y, mind1, mind11, fire2, fire22, air3, air33, water4, water44, earth5, earth55, body6, body66, death7, death77, chaos8, chaos88, law9, law99:integer;
  393. begin //air and chaos detection needs to be fixed
  394. mind1 := 133906; // new
  395. fire2 := 1121418; //new
  396. air3 := DTMFromString('mFQEAAHic42VgYOhgZGDoAuJeIO6D4n6oWBsQNwFxAxQ3QsXsgPpMgdgCiK0ZIHxHIHYFYhcgdgJieyC2AWJLqLonDx6QjPmB+kjFjGRgFAAAz50tPg==');
  397. water4 := 9049105; //new
  398. earth5 := 538965; //new
  399. body6 := 10951188; //new
  400. death7 := DTMFromString('m1gAAAHic42JgYPAFYi8oHQjEwUAcAMRBUNoHiD2B+CwQnwHiU0B8EsoGiV0E4itQfB6IRQQFGfZu3oyCsYnxA9USgxmJxAgAAMESHUs=');
  401. chaos8 := 608072; //fix
  402. law9 := 11934228; //new
  403. mind11 := 1738719; //new
  404. fire22 := 1319335; //new
  405. air33 := DTMFromString('mFQEAAHic42VgYOhgZGDoAuJeIO6D4n6oWBsQNwFxAxQ3QsXsgPpMgdgCiK0ZIHxHIHYFYhcgdgJieyC2AWJLqLonDx6QjPmB+kjFjGRgFAAAz50tPg==');
  406. water44 := 10951188; //new
  407. earth55 := 870508; //new
  408. body66 := 13639447; //new
  409. death77 := DTMFromString('mWAAAAHicY2FgYGgG4hYgbgfiViCOBeJIII4B4gQgFhEUZHjy4AGYBmF+oBgyZkTDIAAAnHoHEA==');
  410. chaos88 := 1613009; //new
  411. law99 := 14623002; //new
  412. c := 22;
  413. numbstring := '';
  414. for i:=1 to 9 do
  415. begin
  416. z := 133;
  417. for v:=1 to 9 do
  418. begin
  419. if (FindColorTolerance(x, y, mind1, z-15, c-15, z+15, c+15, 5) or FindColorTolerance(x, y, mind11, z-15, c-15, z+15, c+15, 5)) then
  420. begin
  421. numbstring := numbstring + '1';
  422. end else if (FindColorTolerance(x, y, fire2, z-15, c-15, z+15, c+15, 5) or FindColorTolerance(x, y, fire22, z-15, c-15, z+15, c+15, 5)) then
  423. begin
  424. numbstring := numbstring + '2';
  425. end else if (FindDTM(air3, x, y, z-15, c-15, z+15, c+15)) then
  426. begin
  427. numbstring := numbstring + '3';
  428. end else if (FindColorTolerance(x, y, water4, z-15, c-15, z+15, c+15, 5) or FindColorTolerance(x, y, water44, z-15, c-15, z+15, c+15, 5)) then
  429. begin
  430. numbstring := numbstring + '4';
  431. end else if (FindColorTolerance(x, y, earth5, z-15, c-15, z+15, c+15, 5) or FindColorTolerance(x, y, earth55, z-15, c-15, z+15, c+15, 5)) then
  432. begin
  433. numbstring := numbstring + '5';
  434. end else if (FindColorTolerance(x, y, body6, z-15, c-15, z+15, c+15, 5) or FindColorTolerance(x, y, body66, z-15, c-15, z+15, c+15, 5)) then
  435. begin
  436. numbstring := numbstring + '6';
  437. end else if (FindDTM(death7, x, y, z-15, c-15, z+15, c+15) or FindDTM(death77, x, y, z-15, c-15, z+15, c+15)) then
  438. begin
  439. numbstring := numbstring + '7';
  440. end else if (FindColorTolerance(x, y, chaos8, z-15, c-15, z+15, c+15, 5) or FindColorTolerance(x, y, chaos88, z-15, c-15, z+15, c+15, 5)) then
  441. begin
  442. numbstring := numbstring + '8';
  443. end else if (FindColorTolerance(x, y, law9, z-15, c-15, z+15, c+15, 5) or FindColorTolerance(x, y, law99, z-15, c-15, z+15, c+15, 5)) then
  444. begin
  445. numbstring := numbstring + '9';
  446. end else
  447. begin
  448. numbstring := numbstring + '0';
  449. end;
  450. z := z+37;
  451. end;
  452. c := c+37;
  453. end;
  454. FreeDTM(air3);
  455. FreeDTM(death7);
  456. FreeDTM(air33);
  457. FreeDTM(death77);
  458. end;
  459.  
  460. procedure inputAnswer;
  461. var
  462. x1, y1:integer;
  463. begin
  464. x1 := 29;
  465. y1 := 112;
  466. for v:=1 to 9 do
  467. begin
  468. MMouse(x1, y1, 5, 5);
  469. wait(100)
  470. ClickMouse2(mouse_left);
  471. for i:=1 to 81 do
  472. begin
  473. if (strtoint(ansArray[i]) = v) then
  474. begin
  475. if not (strtoint(numbstring[i]) = v) then
  476. begin
  477. MMouse(((133)+(37*((i-1) mod 9))), ((22)+(37*((i-1)/9))), 3, 3);
  478. wait(50+random(55));
  479. ClickMouse2(mouse_left);
  480. wait(ClickDelay+random(2));
  481. end;
  482. end;
  483. end;
  484. y1 := y1 + 50;
  485. if (v = 5) then
  486. begin
  487. y1 := 160; //used to be 112
  488. x1 := x1 + 50;
  489. end;
  490. end;
  491. end;
  492.  
  493. procedure SolveLargePuzzle;
  494. var
  495. x, y:integer;
  496. begin
  497. v := 0
  498. repeat
  499. wait(100+random(100));
  500. v := v+1;
  501. writeln('1A');
  502. until ((FindColorTolerance(x, y, 797794, 470, 20, 490, 40, 5) or (v = 30)))
  503. if (FindColorTolerance(x, y, 797794, 470, 20, 490, 40, 5)) then
  504. begin
  505. writeln('2A');
  506. writeNumbstring;
  507. writeln('2');
  508. writeln(numbstring);
  509. writeln('3');
  510. writeAnsArray(numbstring);
  511. writeln('4');
  512. findAnswer;
  513. writeln('5');
  514. outputPuzzle;
  515. writeln('6');
  516. inputAnswer;
  517. writeln('7');
  518. end;
  519. end;
  520.  
  521. procedure BuyRunes;
  522. var
  523. counter, x, y,a,b,c,d,e,f,g,h:integer; //gotta call the throw away variables
  524. begin
  525. if (FindColorTolerance(x, y, 797794, 470, 20, 490, 40, 5)) then
  526. begin
  527. logoutTimer := 0;
  528. MMouse(50, 70, 30, 5);
  529. wait(50+random(40));
  530. ClickMouse2(mouse_left);
  531. Wait(3000+random(500));
  532. FindNPCChatText('what', Clickleft);
  533. wait(900);
  534. //FindColorSpiralTolerance(x, y, 1411858, MSX1, MSY1, MSX2, MSY2, 30); //finds the nature rune
  535.  
  536. //Deaths Start
  537. if (buyDeathRunes = true) then
  538. begin
  539. counter := 0;
  540. while FindColorTolerance(a,b,8290184,136,83,136,83,15) and (counter < 25) do
  541. begin
  542. if (Pos('enough coins.', GetBlackChatMessage) > 0) then
  543. begin
  544. counter := 100;
  545. stopScript := 1;
  546. //closeInterface;
  547. //exit;
  548. end;
  549. counter := counter + 1;
  550. mousebox(137,79,149,91, mouse_right);
  551. wait(100 + random(50));
  552. waitoption('10', mouse_left);
  553. wait(100 + random(50));
  554. end;
  555. end;
  556.  
  557. //Minds Start
  558. if (buyMindRunes = true) then
  559. begin
  560. counter := 0;
  561. while FindColorTolerance(c,d,8158598,181,83,181,83,15) and (counter < 25) do
  562. begin
  563. if (Pos('enough coins.', GetBlackChatMessage) > 0) then
  564. begin
  565. counter := 100;
  566. stopScript := 1;
  567. //exit;
  568. end;
  569. counter := counter + 1;
  570. mousebox(185,80,195,91, mouse_right);
  571. wait(100 + random(50));
  572. waitoption('10', mouse_left);
  573. wait(100 + random(50));
  574. end;
  575. end;
  576.  
  577. //Nats Start
  578. if (buyNatureRunes = true) then
  579. begin
  580. counter := 0;
  581. while FindColorTolerance(e,f,7434874,274,87,274,87,15) and (counter < 25) do
  582. begin
  583. if (Pos('enough coins.', GetBlackChatMessage) > 0) then
  584. begin
  585. counter := 100;
  586. stopScript := 1;
  587. //exit;
  588. end;
  589. counter := counter + 1;
  590. mousebox(278,80,290,92, mouse_right);
  591. wait(100 + random(50));
  592. waitoption('10',mouse_left);
  593. wait(100 + random(50));
  594. end;
  595. end;
  596.  
  597. //Chaos
  598. if (buyChaosRunes = true) then
  599. begin
  600. counter := 0;
  601. while FindColorTolerance(g,h,1812704,374,81,374,81,15) and (counter < 25) do
  602. begin
  603. if (Pos('enough coins.', GetBlackChatMessage) > 0) then
  604. begin
  605. counter := 100;
  606. stopScript := 1;
  607. //exit;
  608. end;
  609. counter := counter + 1;
  610. MMouse(373,82,5,5);
  611. wait(100 + random(50));
  612. ClickMouse2(mouse_right);
  613. wait(100 + random(50));
  614. waitoption('10',mouse_left);
  615. wait(100 + random(50));
  616. end;
  617. end;
  618. //Cosmics Start
  619. if (buyCosmicRunes = true) then
  620. begin
  621. counter := 0;
  622. while FindColorTolerance(g,h,8421770,87,129,87,129,15) and (counter < 25) do
  623. begin
  624. if (Pos('enough coins.', GetBlackChatMessage) > 0) then
  625. begin
  626. counter := 100;
  627. stopScript := 1;
  628. //exit;
  629. end;
  630. counter := counter + 1;
  631. mousebox(91,127,101,138,mouse_right);
  632. wait(100 + random(50));
  633. waitoption('10',mouse_left);
  634. wait(100 + random(50));
  635. end;
  636. end;
  637.  
  638. //if((not(FindColorTolerance(a,b,797794,58,33,58,33,15))) and ((buyDeathRunes = true and FindColorTolerance(a,b,8290184,136,83,136,83,15)) or (buyMindRunes = true and FindColorTolerance(c,d,8158598,181,83,181,83,15)) or (buyNatureRunes = true and FindColorTolerance(e,f,7434874,274,87,274,87,15)) or (buyChaosRunes = true and FindColorTolerance(g,h,1812704,374,81,374,81,15)) or (buyCosmicRunes = true and FindColorTolerance(g,h,8421770,87,129,87,129,15)))) then
  639. //begin
  640. //writeln('Oops, we forgot some Runes. Going back to buy them...');
  641. //BuyRunes;
  642. //end
  643. //else
  644. //begin
  645. wait(200);
  646. //if (FindColorTolerance(x, y, 797794, 470, 20, 490, 40, 5)) then
  647. //begin
  648. MMouse(484, 39, 5, 5);
  649. wait(200);
  650. ClickMouse2(mouse_left);
  651. //end
  652. //end;
  653. end;
  654. //put buy stuff here
  655. end;
  656. Procedure MainLoop;
  657. var
  658. a, b, c, d:integer; //gotta call the throw away variables
  659. begin
  660. if (not(FindColorTolerance(a,b,797794,67,39,67,39,15))) then
  661. begin
  662. CheckIfLoggedOut;
  663. MakeCompass(-95+random(40));
  664. TalkToAli;
  665. end;
  666. Try
  667. begin
  668. SolveLargePuzzle;
  669. BuyRunes;
  670. AntiBan;
  671. logoutTimer := logoutTimer + 1;
  672. if ((logoutTimer > 5) and (not(FindColorTolerance(x, y, 797794, 470, 20, 490, 40, 5)))) then
  673. begin
  674. writeln('We are not near Ali anymore. Logging out for safety reasons...');
  675. logout;
  676. stopScript := 1;
  677. exit;
  678. end;
  679. Writeln('RunTime : '+TimeRunning);
  680. Writeln('Caskets Opened : '+toStr(count));
  681. Writeln('Large caskets per hour : ' + toStr((3600000*count)/GetTimeRunning));
  682. end;
  683. Except
  684. if (FindColorTolerance(a,b,797794,67,39,67,39,15)) then
  685. begin
  686. MMouse(19, 19, 5, 5);
  687. wait(200);
  688. ClickMouse2(mouse_left);
  689. Writeln('We have encountered an error solving this puzzle.');
  690. Writeln('Starting a new puzzle... (This used to break our script.)');
  691. wait(200);
  692. end
  693. else
  694. begin
  695. Writeln('We have encountered an error somewhere...');
  696. Writeln('We are somehow also not on the Rune Sudoku screen anymore...');
  697. Writeln('Attempting to log out and then back in to restart the script.');
  698. MMouse(642, 483, 5, 5);
  699. ClickMouse2(mouse_left);
  700. wait(200);
  701. MMouse(637, 375, 5, 5);
  702. ClickMouse2(mouse_left);
  703. wait(5000);
  704. if (FindColorTolerance(c,d,5458504,356,215,356,215,15)) then //Checks for login screen
  705. begin
  706. MMouse(437, 288, 5, 5);
  707. ClickMouse2(mouse_left);
  708. wait(1000);
  709. LogIn;
  710. end;
  711. end;
  712. end;
  713. end;
  714.  
  715. begin
  716. SetupSRL();
  717. Declareplayers;
  718. LogIn;
  719. stopScript := 0;
  720. Repeat
  721. MainLoop;
  722. Until false or (stopScript = 1);
  723. Logout;
  724. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement