Advertisement
Guest User

Untitled

a guest
Jul 17th, 2017
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 24.63 KB | None | 0 0
  1. program New;
  2. {$DEFINE SMART}
  3. {$i SRL\SRL.scar}
  4. {$i SRL\SRL\Misc\Stats.Simba}
  5.  
  6.  
  7. const
  8. S_Mems = True; //Members?
  9. S_World = 38; //Smart world
  10. S_Signed = True; //Signed client?
  11. StatsUserName = ''; //SRL Stats username
  12. StatsPassword = ''; //SRL Stats password
  13. ShowDebug = False; //Show debugging?
  14.  
  15.  
  16. procedure DeclarePlayers;
  17. begin
  18. with Players[0] do
  19. begin
  20. Name := '';
  21. Pass := '';
  22. Pin := '';
  23. Active := True;
  24. Integers[0] := 0; //Time between breaks in minutes. Leave 0 to not take breaks.
  25. Integers[1] := 0; //Break time in minutes. Leave 0 to not take breaks.
  26. end;
  27. end;
  28.  
  29.  
  30. var
  31. StatsTimer, BreakTimer: Integer;
  32. Stats: TIntegerArray;
  33.  
  34.  
  35. const
  36. {script info}
  37. VERSION = '08';
  38. {player info enumerations}
  39. GLASS_MADE = 2;
  40. TIMES_CASTED = 3;
  41. LEVELS_MAGIC = 4;
  42. LEVELS_CRAFTING = 5;
  43. LAST_SAND_INDEX = 6;
  44. LAST_SEAWEED_INDEX = 7;
  45. LAST_SAND_TAB_INDEX = 9;
  46. LAST_SEAWEED_TAB_INDEX = 10;
  47. {SRL Stats enumerations}
  48. EXP = 0;
  49. LEVELS_GAINED = 1;
  50. MOLTENGLASS_MADE = 2;
  51. SUPERGLASS_CASTED = 3;
  52. {Counting type enumerations}
  53. GLASS = 1;
  54. SAND = 2;
  55. SEAWEED = 3;
  56. {sort type enumerations}
  57. sort_Level = 0;
  58. sort_Combat = 1;
  59. sort_Teleport = 2;
  60. {Hide/Show enumerations}
  61. hs_Combat = 0;
  62. hs_Teleport = 1;
  63. hs_Misc = 2;
  64.  
  65.  
  66. procedure Die(Reason: string);
  67. begin
  68. if BankScreen then
  69. CloseBank;
  70. FindNormalRandoms;
  71. Logout;
  72. Players[CurrentPlayer].Active := False;
  73. if (Players[CurrentPlayer].Status = '') then
  74. begin
  75. Players[CurrentPlayer].Status := Reason;
  76. Writeln('Player ' + IntToStr(CurrentPlayer) + ' set to false because: ' + Reason);
  77. end;
  78. end;
  79.  
  80.  
  81. procedure Debug(What: string; Levels: Integer);
  82. var
  83. Str: String;
  84. i: Integer;
  85. begin
  86. if not(ShowDebug) then
  87. Exit;
  88. for i := 0 to Levels do
  89. Str := Str + ' ';
  90. Str := Str + '>';
  91. Writeln(Str + What);
  92. end;
  93.  
  94.  
  95. function OpenVWBank: Boolean;
  96. var
  97. TPA, TPA1, TPA2: TPointArray;
  98. ATPA: T2DPointArray;
  99. CTS, x, y, i: Integer;
  100. HueMod, SatMod: Extended;
  101. begin
  102. if not(LoggedIn) then
  103. Exit;
  104. Debug('New procedure: OpenVWBank', 0);
  105. Debug('Finding TPA for Bankers', 1);
  106. CTS := GetColorToleranceSpeed;
  107. GetColorspeed2Modifiers(HueMod, SatMod);
  108. SetColorToleranceSpeed(2);
  109. SetColorspeed2Modifiers(3.20, 0.64); //Male mods
  110. FindColorsTolerance(TPA1, 4869442, MSX1, MSY1, MSX2, MSY2, 9); //Male col/tol
  111. SetColorspeed2Modifiers(0.07, 0.23); //Female mods
  112. FindColorsTolerance(TPA2, 4597555, MSX1, MSY1, MSX2, MSY2, 5); //Female col/tol
  113. SetColorSpeed2Modifiers(HueMod, SatMod);
  114. SetColorToleranceSpeed(CTS);
  115. TPA := MergeATPA([TPA1, TPA2]);
  116. if (Length(TPA) < 1) then
  117. Exit;
  118. Debug('Length of TPA: ' + IntToStr(Length(TPA)), 2);
  119. SortTPAFrom(TPA, IntToPoint(MSCX, MSCY));
  120. Debug('Splitting & Sorting ATPA', 1);
  121. ATPA := TPAtoATPAEx(TPA, 30, 30);
  122. SortATPAFromFirstPoint(ATPA, IntToPoint(MSCX, MSCY));
  123. Debug('Length of ATPA: ' + IntToStr(Length(ATPA)), 2);
  124. for i := 0 to High(ATPA) do
  125. begin
  126. Debug('Length of ATPA[' + IntToStr(i) + ']: ' + IntToStr(Length(ATPA[i])), 1);
  127. if (Length(ATPA[i]) < 60) then
  128. begin
  129. Debug('Length of ATPA[' + IntToStr(i) + '] Was less than 60, skipping to next TPA', 1);
  130. Continue;
  131. end;
  132. MiddleTPAEx(ATPA[i], x, y);
  133. if PointInBox(IntToPoint(x, y), IntToBox(232, 144, 281, 184)) then
  134. begin
  135. Debug('The middle of ATPA[' + IntToStr(i) + '] was on the character, skipping to next TPA', 1);
  136. Continue;
  137. end;
  138. Debug('ATPA[' + IntToStr(i) + '] was found to be suitable. Mousing', 1);
  139. MMouse(x - 3, y - 3, 6, 6);
  140. if WaitUptext('anke', 1200) then
  141. begin
  142. Debug('Uptext ''anke'' found on ATPA[' + IntToStr(i) + ']', 1);
  143. ClickMouse2(False);
  144. Wait(60 + Random(40));
  145. if WaitOption('ank B', 1200) then
  146. begin
  147. Debug('Option ''ank B'' was chosen, exiting loop', 1);
  148. Break;
  149. end;
  150. end;
  151. end;
  152. if FFlag(0) then
  153. Wait(800 + Random(400));
  154. Result := WaitFunc(@BankScreen, 5 + Random(5), 2200);
  155. if Result then
  156. Debug('OpenVWBank: success!', 1);
  157. end;
  158.  
  159.  
  160. {Attempts function func (Called like "@Function") Attempts # of times. If the function failse then
  161. it Rotates the camera by SwivelPer plus or minus 10 degrees}
  162. function AttemptAndSwivel(func: function: Boolean; Attempts, SwivelPer: Integer): Boolean;
  163. var
  164. i: Integer;
  165. begin
  166. for i := 1 to Attempts do
  167. begin
  168. if func() then
  169. begin
  170. Result := True;
  171. Exit;
  172. end;
  173. MakeCompass(rs_GetCompassAngleDegrees + (SwivelPer + Random(10) - Random(10)));
  174. Wait(800 + Random(80));
  175. end;
  176. end;
  177.  
  178.  
  179. function Count(Which: Integer): Integer;
  180. var
  181. i, x, y, BlackCount, Color, Tolerance, XMod, YMod: Integer;
  182. Box: TBox;
  183. begin
  184. if not(LoggedIn) then
  185. Exit;
  186. Debug('New function: Count(Which: Integer)', 0);
  187. Debug('Searching for item type ' + IntToStr(Which), 1);
  188. case Which of
  189. GLASS:
  190. begin
  191. BlackCount := 60;
  192. Color := 4024011;
  193. Tolerance := 4;
  194. XMod := 10;
  195. YMod := 11;
  196. end;
  197. SAND:
  198. begin
  199. BlackCount := 20;
  200. Color := 4879491;
  201. Tolerance := 12;
  202. XMod := 14;
  203. YMod := 14;
  204. end;
  205. SEAWEED:
  206. begin
  207. BlackCount := 120;
  208. Color := 3297035;
  209. Tolerance := 8;
  210. XMod := 12;
  211. YMod := 14;
  212. end;
  213. end;
  214. for i := 1 to 28 do
  215. begin
  216. Debug('Checking inventory spot ' + IntToStr(i), 1);
  217. Box := InvBox(i);
  218. if (CountColor(131072, Box.X1, Box.Y1, Box.X2, Box.Y2) > BlackCount) then
  219. begin
  220. Debug('More than ' + IntToStr(BlackCount) + ' black pixels foundon inventory spot ' + IntToStr(i) + ', checking for color too', 2);
  221. if FindColorTolerance(x, y, Color, Box.X1 + XMod, Box.Y1 + YMod, Box.X1 + XMod, Box.Y1 + YMod, Tolerance) then
  222. begin
  223. Debug('Item type ' + IntToStr(Which) + ' found at slot ' + IntToStr(i) + '!', 2);
  224. Inc(Result);
  225. end;
  226. end;
  227. end;
  228. Debug('Result of CountGlass: ' + IntToStr(Result), 1);
  229. end;
  230.  
  231.  
  232. function GetSortType: Integer;
  233. var
  234. i: Integer;
  235. begin
  236. if not(LoggedIn) or (GetCurrentTab <> tab_Magic) then
  237. Exit;
  238. Debug('New function: GetSortType', 0);
  239. for i := 0 to 2 do
  240. begin
  241. Debug('Checking for sort type ' + IntToStr(i), 1);
  242. if (GetColor(675 + (i * 19), 442) = 16711422) then
  243. begin
  244. Debug('Color found!', 2);
  245. Result := i;
  246. Break;
  247. end;
  248. end;
  249. Debug('Result of GetSortType: ' + IntToStr(Result), 1);
  250. end;
  251.  
  252.  
  253. function FixLunarSpellBook: Boolean;
  254. var
  255. i: Integer;
  256. begin
  257. if not(LoggedIn) then
  258. Exit;
  259. Debug('New function: FixLunarSpellBook', 0);
  260. if (GetCurrentTab <> tab_Magic) then
  261. if not(GameTab(tab_Magic)) then
  262. Exit;
  263. for i := hs_Combat to hs_Misc do
  264. begin
  265. Debug('checking button ' + IntToStr(i), 1);
  266. if (GetColor(589 + (i * 26), 442) <> 16711422) then
  267. begin
  268. Debug('Button ' + IntToStr(i) + ' was hidden, clicking button', 2);
  269. Mouse(589 + (i * 26), 442, 17, 17, True);
  270. end;
  271. end;
  272. Result := ((GetColor(589, 442) = 16711422) and (GetColor(615, 442) = 16711422) and (GetColor(641, 442) = 16711422))
  273. if Result then
  274. Debug('FixLunarSpellBook: Success!', 1);
  275. end;
  276.  
  277.  
  278. function CastGlassMake: Boolean;
  279. var
  280. SearchBox: TBox;
  281. ClickPoint: TPoint;
  282. begin
  283. if not(LoggedIn) then
  284. Exit;
  285. Debug('New function: CastGlassMake', 0);
  286. if (GetCurrentTab <> tab_Magic) then
  287. if not(GameTab(tab_Magic)) then
  288. Exit;
  289. if not(FixLunarSpellBook) then
  290. Exit;
  291. case GetSortType of
  292. sort_Level:
  293. begin
  294. SearchBox := IntToBox(561, 304, 580, 327);
  295. ClickPoint := IntToPoint(564, 307);
  296. end;
  297. sort_Combat:
  298. begin
  299. SearchBox := IntToBox(705, 275, 724, 296);
  300. ClickPoint := IntToPoint(708, 275);
  301. end;
  302. sort_Teleport:
  303. begin
  304. SearchBox := IntToBox(678, 305, 696, 325);
  305. ClickPoint := IntToPoint(676, 306);
  306. end;
  307. end;
  308. Debug('Searching the box (' + IntToStr(SearchBox.X1) + ', ' + IntToStr(SearchBox.Y1) + ', ' + IntToStr(SearchBox.X2) + ', ' + IntToStr(SearchBox.Y2) + ')', 1);
  309. if (CountColorTolerance(1574025, SearchBox.X1, SearchBox.Y1, SearchBox.X2, SearchBox.Y2, 74) > 45) then
  310. begin
  311. Debug('More than 45 red pixels found in box! Clicking spell.', 2);
  312. MMouse(ClickPoint.x, ClickPoint.y, 11, 16);
  313. if WaitUptext('pergl', 1400) then
  314. begin
  315. Debug('Uptext ''pergl'' found.', 1);
  316. ClickMouse2(True);
  317. end;
  318. end;
  319. GameTab(tab_Inv);
  320. Result := WaitInvMinCount(3, 2500); //astrals, fires, and at least 1 molten glass = at least 3 items
  321. if Result then
  322. Debug('CastGlassMake: Success!', 1);
  323. end;
  324.  
  325.  
  326. function DepositItem(Which: Integer): Boolean;
  327. var
  328. i, Slot, x, y, BlackCount, Color, XMod, YMod, Tolerance: Integer;
  329. Box: TBox;
  330. begin
  331. if not(LoggedIn) or not(BankScreen) then
  332. Exit;
  333. case Which of
  334. GLASS:
  335. begin
  336. BlackCount := 60;
  337. Color := 4024011;
  338. Tolerance := 4;
  339. XMod := 10;
  340. YMod := 11;
  341. end;
  342. SAND:
  343. begin
  344. BlackCount := 20;
  345. Color := 4879491;
  346. Tolerance := 12;
  347. XMod := 14;
  348. YMod := 14;
  349. end;
  350. SEAWEED:
  351. begin
  352. BlackCount := 120;
  353. Color := 3297035;
  354. Tolerance := 8;
  355. XMod := 12;
  356. YMod := 14;
  357. end;
  358. end;
  359. Debug('New function: Deposit', 0);
  360. if (Count(GLASS) = 0) then
  361. begin
  362. Debug('Item was not in the inventory. Setting true and exiting', 1);
  363. Result := True;
  364. Exit;
  365. end;
  366. for i := 3 to InvCount do
  367. begin
  368. Debug('checking for item in inventory spot ' + IntToStr(i), 1);
  369. Box := InvBox(i);
  370. if (CountColor(131072, Box.X1, Box.Y1, Box.X2, Box.Y2) > 60) then
  371. begin
  372. Debug('more than ' + IntToStr(BlackCount) + ' black pixels found, checking for color', 2);
  373. if FindColorTolerance(x, y, Color, Box.X1 + XMod, Box.Y1 + YMod, Box.X1 + XMod, Box.Y1 + YMod, Tolerance) then
  374. //if SimilarColors(GetColor(Box.X1 + 10, Box.Y1 + 11), 4024011, 3) then
  375. begin
  376. Debug('Found item!', 2);
  377. Slot := i;
  378. Break;
  379. end;
  380. end;
  381. end;
  382. if (Slot = 0) then
  383. begin
  384. Debug('Slot was found to be 0, exiting :(', 1);
  385. Exit;
  386. end;
  387. InvMouse(Slot, 2);
  388. Result := WaitOption('ll M', 1200);
  389. if Result then
  390. WaitInvCount(2, 2000, ExactCT);
  391. Debug('DepostGlass: success!', 1);
  392. end;
  393.  
  394.  
  395. function WaitFindTextTPA(Color, Tol, xs, ys, xe, ye: Integer; Txt, CharType: string; Action: fnct_ActionOptions; WaitBetween, MaxTime: Integer): Boolean;
  396. var
  397. T: Integer;
  398. begin
  399. T := GetSystemTime + MaxTime;
  400. repeat
  401. if FindTextTPA(Color, Tol, xs, ys, xe, ye, Txt, CharType, Action) then
  402. begin
  403. Result := True;
  404. Exit;
  405. end;
  406. Wait(WaitBetween);
  407. until(GetSystemTime > T);
  408. end;
  409.  
  410.  
  411. function WithdrawWhich(Which: Integer): Boolean;
  412. var
  413. x, y, i, Index, BlackCount, Color, XMod, YMod, Tolerance: Integer;
  414. UT, Option: string; ///*U*p*T*ext
  415. Box: TBox;
  416. begin
  417. if not(LoggedIn) or not(BankScreen) then
  418. Exit;
  419. case Which of
  420. SAND:
  421. begin
  422. BlackCount := 20;
  423. Color := 4879491;
  424. Tolerance := 12;
  425. XMod := 14;
  426. YMod := 14;
  427. UT := 'san';
  428. Option := '13 B'
  429. end;
  430. SEAWEED:
  431. begin
  432. BlackCount := 120;
  433. Color := 3297035;
  434. Tolerance := 8;
  435. XMod := 12;
  436. YMod := 14;
  437. UT := 'eaw';
  438. Option := '13 S';
  439. end;
  440. end;
  441. Debug('New function: WithdrawWhich', 0);
  442. FixBank;
  443. for i := 1 to 40 do
  444. begin
  445. Debug('Searching bank index ' + IntToStr(i), 1);
  446. Box := BankIndexToMSBox(i);
  447. if (CountColor(131072, Box.X1, Box.Y1, Box.X2, Box.Y2) > BlackCount) then
  448. begin
  449. Debug('More than ' + IntToStr(BlackCount) + ' black pixels found, checking for color', 2);
  450. if FindColorTolerance(x, y, Color, Box.X1 + XMod, Box.Y1 + YMod, Box.X1 + XMod, Box.Y1 + YMod, Tolerance) then
  451. begin
  452. Debug('Color found!', 2);
  453. Index := i;
  454. if (Index <> 0) then
  455. case Which of
  456. SAND: Players[CurrentPlayer].Integers[LAST_SAND_INDEX] := Index;
  457. SEAWEED: Players[CurrentPlayer].Integers[LAST_SEAWEED_INDEX] := Index;
  458. end;
  459. Break;
  460. end;
  461. end;
  462. end;
  463. if (Index) = 0 then
  464. begin
  465. Debug('Index was 0, trying last known index.', 1);
  466. case Which of
  467. SAND: Index := Players[CurrentPlayer].Integers[LAST_SAND_INDEX];
  468. SEAWEED: Index := Players[CurrentPlayer].Integers[LAST_SEAWEED_INDEX];
  469. end;
  470. end;
  471. Box := BankIndexToMSBox(Index);
  472. MMouse(Box.X1 + 4, Box.Y1 + 4, Box.X2 - Box.X1 - 4, Box.Y2 - Box.Y1 - 4);
  473. if WaitUptext(UT, 1200) then
  474. begin
  475. Debug('Uptext ' + UT + ' found', 1);
  476. ClickMouse2(False);
  477. Wait(150 + Random(100));
  478. if WaitOption('13 B', 1800) then
  479. begin
  480. Debug('Chose option ''13 B''', 1);
  481. Result := True;
  482. Wait(200 + Random(50));
  483. end;
  484. if not(Result) then
  485. begin
  486. Debug('Could not withdraw 13, "Withdraw-X"-ing', 1);
  487. Mouse(Box.X1, Box.Y1, Box.X2 - Box.X1, Box.Y2 - Box.Y1, False);
  488. if WaitOption(Option, 1800) then
  489. begin
  490. Debug('option ''' + Option + ''' chose.', 1);
  491. if WaitFindTextTPA(0, 12, 251, 393, 307, 411, 'n', 'UpChars', Nothing, 500 + Random(15), 2200) then
  492. begin
  493. Debug('Chat box found, typing 13', 1);
  494. TypeSendEx('13', True);
  495. Result := True;
  496. Wait(300 + Random(50));
  497. end;
  498. end;
  499. end;
  500. end;
  501. If Result then
  502. Debug('WithdrawSand: success!', 1);
  503. end;
  504.  
  505.  
  506. //Written by R1ch for SRL, Modified for this script.
  507. function LevelUpWhich(var WhichSkill: Integer): Boolean; //WhichSkill = 1 if Magic, 2 if crafting
  508. var
  509. X, Y : Integer;
  510. begin
  511. if (not(FindColor(X, Y, 0, 7, 460, 69, 474))) then
  512. Result:= FindNPCChatText('gratu', Nothing);
  513. if Result then
  514. begin
  515. if FindNPCChatText('rafting', Nothing) then
  516. WhichSkill := 2
  517. else
  518. if FindNPCChatText('gic', Nothing) then
  519. WhichSkill := 1;
  520. Result := ClickContinue(True, True);
  521. WriteLn(Players[CurrentPlayer].Name + ' leveled up');
  522. end;
  523. end;
  524.  
  525.  
  526. procedure CommitStats;
  527. var
  528. i: Integer;
  529. begin
  530. stats_IncVariable('Total EXP Gained', Stats[EXP]);
  531. stats_IncVariable('Total Levels Gained', Stats[LEVELS_GAINED]);
  532. stats_IncVariable('Molten Glass Made', Stats[MOLTENGLASS_MADE]);
  533. Stats_IncVariable('Superglass Casted', Stats[SUPERGLASS_CASTED]);
  534. if (TimeFromMark(StatsTimer) > 300000) then
  535. begin
  536. stats_Commit;
  537. MarkTime(StatsTimer);
  538. end;
  539. for i := 0 to High(Stats) do
  540. Stats[i] := 0;
  541. end;
  542.  
  543.  
  544. function WithdrawMaterials: Boolean;
  545. var
  546. Attempts: Integer;
  547. Bools: Array[0..1] of Boolean; //Bools[0] = SeaweedSuccess; Bools[1] = SandSuccess;
  548. Counts: array[0..1] of Integer; //Counts[0] = SeaweedCount; Counts[1] = SandCount;
  549. begin
  550. if not(LoggedIn) or not(BankScreen) then
  551. Exit;
  552. repeat
  553. if not(Bools[0]) then
  554. begin
  555. if WithdrawWhich(SEAWEED) then
  556. Bools[0] := True;
  557. Wait(200 + Random(300));
  558. end;
  559. if not(Bools[1]) then
  560. begin
  561. if WithdrawWhich(SAND) then
  562. Bools[1] := True;
  563. Wait(200 + Random(300));
  564. end;
  565. Counts[0] := Count(SEAWEED);
  566. Counts[1] := Count(SAND);
  567. Result := ((Counts[0] >= 1) and (Counts[0] <= 13)) and ((Counts[1] >= 1) and (Counts[1] <= 13));
  568. if Result then
  569. Break;
  570. if not(Bools[0]) then
  571. begin
  572. DepositItem(SEAWEED);
  573. Wait(800 + Random(100));
  574. end;
  575. if not(Bools[1]) then
  576. begin
  577. DepositItem(SAND);
  578. Wait(800 + Random(100));
  579. end;
  580. until(Attempts > 5);
  581. if not(Bools[0]) then
  582. Players[CurrentPlayer].Status := Players[CurrentPlayer].Status + 'Seaweed;';
  583. if not(Bools[1]) then
  584. Players[CurrentPlayer].Status := Players[CurrentPlayer].Status + 'Sand;';
  585. end;
  586.  
  587.  
  588. procedure TakeBreak;
  589. begin
  590. if (Players[CurrentPlayer].Integers[0] = 0) or (Players[CurrentPlayer].Integers[1] = 0) then
  591. Exit;
  592. if (GetSystemTime >= BreakTimer) then
  593. begin
  594. Logout;
  595. Wait(Players[CurrentPlayer].Integers[1] + RandomRange(60000, 180000));
  596. LogInPlayer;
  597. Wait(8000 + Random(4000));
  598. BreakTimer := (GetSystemTime + Players[CurrentPlayer].Integers[0] * 60000) + RandomRange(60000, 180000);
  599. end;
  600. end;
  601.  
  602.  
  603. procedure Report;
  604. //var
  605. //CastsHr, GlassHr, XpHr: Int64;
  606. begin {123456789|12 This is my ruler :p 123456789|12}
  607. Writeln('/---------------------------------------------------\');
  608. Writeln('| TomTuff''s Super Glass Maker |');
  609. Writeln('| Rev ' + VERSION + ' |');
  610. Writeln('|---------------------------------------------------|');
  611. Writeln('| Time Ran: ' + Padr(MsToTime(GetTimeRunning, Time_Short), 39) + '|');
  612. if (Players[0].Integers[LEVELS_MAGIC] > 0) then
  613. Writeln('| Magic Levels Gained: ' + Padr(IntToStr(Players[CurrentPlayer].Integers[LEVELS_MAGIC]), 28) + '|');
  614. if (Players[0].Integers[LEVELS_CRAFTING] > 0) then
  615. Writeln('| Crafting Levels Gained: ' + Padr(IntToStr(Players[CurrentPlayer].Integers[LEVELS_CRAFTING]), 25) + '|');
  616. Writeln('| Times Casted Superglass Make: ' + Padr(IntToStr(Players[CurrentPlayer].Integers[TIMES_CASTED]), 19) + '|');
  617. //CastsHr := Ceil((Players[0].Integers[TIMES_CASTED] * 60.0 * 60.0 * 1000.0) / PlayerWorked(0));
  618. //Writeln('| Times Casted per Hour: ' + Padr(Int64ToStr(CastsHr), 26) + '|');
  619. Writeln('| Molten Glass Made: ' + Padr(IntToStr(Players[CurrentPlayer].Integers[GLASS_MADE]), 30) + '|');
  620. //GlassHr := Ceil((Players[0].Integers[GLASS_MADE] * 60.0 * 60.0 * 1000.0) / PlayerWorked(0));
  621. // Writeln('| Molten Glass Made per Hour: ' + Padr(Int64ToStr(GlassHr), 21) + '|');
  622. Writeln('| Experience Gained: ' + Padr(IntToStr(Players[CurrentPlayer].Integers[TIMES_CASTED] * 78), 30) + '|');
  623. //XpHr := Ceil((Players[0].Integers[TIMES_CASTED * 78] * 60.0 * 60.0 * 1000.0) / PlayerWorked(0));
  624. //Writeln('| Experience Gained per Hour: ' + Padr(Int64ToStr(XpHr), 21) + '|');
  625. if (Players[0].Status <> '') then
  626. begin
  627. Writeln('| Reason for stopping: |');
  628. Writeln('| ' + Padr(Players[0].Status, 49) + '|');
  629. end;
  630. Writeln('\---------------------------------------------------/');
  631. end;
  632.  
  633.  
  634. procedure MainLoop;
  635. var
  636. Angle: Extended;
  637. i, WhichSkill: Integer;
  638. begin
  639. Smart_Members := S_Mems;
  640. Smart_Server := S_World;
  641. Smart_Signed := S_Signed;
  642. Smart_SuperDetail := False;
  643. SetupSRL;
  644. SetLength(Stats, 5);
  645. SetupSRLStats(31, StatsUserName, StatsPassword);
  646. HowManyPlayers := 1;
  647. NumberOfPlayers(HowManyPlayers);
  648. CurrentPlayer := 0;
  649. DeclarePlayers;
  650.  
  651. ActivateClient;
  652.  
  653. if (StatsPassword = '') or (StatsUsername = '') then
  654. begin
  655. Writeln('Please Get SRL Stats to avoid this 15 second wait (or dont be a noob and take it out yourself... but really, get stats)');
  656. for i := 15 downto 1 do
  657. begin
  658. Writeln(IntToStr(i) + '...');
  659. Wait(999);
  660. end;
  661. end;
  662.  
  663. if not(LoggedIn) then
  664. begin
  665. LoginPlayer;
  666. Wait(2000 + Random(1000));
  667. end;
  668.  
  669. MarkTime(StatsTimer);
  670. if not((Players[CurrentPlayer].Integers[0] = 0) or (Players[CurrentPlayer].Integers[1] = 0)) then
  671. BreakTimer := (GetSystemTime + Players[CurrentPlayer].Integers[0] * 60000) + RandomRange(60000, 180000);
  672.  
  673. SetAngle(True);
  674.  
  675. repeat
  676. repeat
  677. if LoggedIn then
  678. Players[CurrentPlayer].Status := '';
  679. FindNormalRandoms;
  680. if LevelUpWhich(WhichSkill) then
  681. begin
  682. Inc(Stats[LEVELS_GAINED]);
  683. case WhichSkill of
  684. 1: Inc(Players[CurrentPlayer].Integers[LEVELS_MAGIC]);
  685. 2: Inc(Players[CurrentPlayer].Integers[LEVELS_CRAFTING]);
  686. end;
  687. end;
  688. if AttemptAndSwivel(@OpenVWBank, 8, 45) then
  689. begin
  690. Wait(600 + Random(200));
  691. IncEx(Players[CurrentPlayer].Integers[GLASS_MADE], Count(GLASS));
  692. IncEx(Stats[EXP], Count(GLASS) * 10);
  693. IncEx(Stats[GLASS_MADE], Count(GLASS));
  694. if DepositItem(GLASS) then
  695. begin
  696. Wait(100 + Random(200));
  697. if WithdrawMaterials then
  698. begin
  699. Wait(200 + Random(50));
  700. if CloseBank then
  701. begin
  702. FindNormalRandoms;
  703. if (Random(9) = 0) then
  704. begin
  705. Angle := rs_GetCompassAngleDegrees;
  706. MakeCompass(Angle - 30 + Random(60));
  707. end;
  708. if (Random(19) = 0) then
  709. HoverSkill('magic', False);
  710. if CastGlassMake then
  711. begin
  712. Inc(Players[CurrentPlayer].Integers[TIMES_CASTED]);
  713. Inc(Stats[SUPERGLASS_CASTED]);
  714. IncEx(Stats[EXP], 78);
  715. if LevelUpWhich(WhichSkill) then
  716. begin
  717. Inc(Stats[LEVELS_GAINED]);
  718. case WhichSkill of
  719. 1: Inc(Players[CurrentPlayer].Integers[LEVELS_MAGIC]);
  720. 2: Inc(Players[CurrentPlayer].Integers[LEVELS_CRAFTING]);
  721. end;
  722. end;
  723. Wait(1500 + Random(400));
  724. end else
  725. Die('could not cast glass make');
  726. end else
  727. Die('could not close the bank');
  728. end else
  729. Die('Failed to withdraw: ' + Players[CurrentPlayer].Status);
  730. end else
  731. Die('could not deposit the glass');
  732. end else
  733. Die('could not open the bank');
  734. Report;
  735. CommitStats;
  736. TakeBreak;
  737. until(not(LoggedIn));
  738. until(AllPlayersInactive);
  739. Report;
  740. TerminateScript;
  741. end;
  742.  
  743.  
  744. begin
  745. MainLoop;
  746. end.
  747.  
  748.  
  749. {
  750. Revision History
  751. Revision 1:
  752. Release.
  753. Revision 2:
  754. [*] Modified Die() procedure to set the player to false, and not to re-set status
  755. if the status is already set.
  756. [*] Added FixLunarSpellBook(): Boolean;
  757. [*] Added a 10% chance to rotate the camera 30 degrees after banking for antiban
  758. [*] Fixed standards on Report();
  759. [*] Added most of the setup info to the actual thread rather than the script header
  760. [*] Changed the point color check for sand buckets to work when there's
  761. > 1k buckets (Yellow pixels block the oldpoint check).
  762. Revision 3:
  763. [*] Fixed some more stuff regarding Players[X].Status
  764. [*] Added FFlag(0) to OpenVWBank();
  765. [*] Added SRL Stats :3 (Thanks KongKing for his SRL-Stats-For-Dummies type explanation)
  766. [*] Added WaitFindTextTPA and Level counting (level counting also in SRL Stats)
  767. [*] Added breaking
  768. [*] Removed all the per hour stuff from reports until i get it working
  769. Revision 3QP:
  770. [*] Added some static wait times to the main loop
  771. Revision 4:
  772. [*] Fixed OpenVWBank to search for Males AND Females, and to require more points
  773. in a TPA before it checks it (10 ==> 90).
  774. [*] Fixed OpenVWBank to split the ATPA in to smaller boxes because some of the
  775. plantes behind the bankers were throwing it off (40x40 boxes ==> 30x30 boxes)
  776. [*] Removed SetAngle(True); from OpenVWBank and instead added it to the beginning
  777. of the main loop. To compensate for the wait time gained by using SetAngle,
  778. A longer static wait time was added after successfully casting the spell
  779. [*] Fixed a bug with the SRL Stats Implementation (forgot to re-mark time).
  780. Revision 5:
  781. [*] Extraneous function "Commit()" removed.
  782. [*] All enumerations gathered into one place
  783. [*] New constant SCRIPT_VER for proggie ("Writeln('Rev 05')" ==> "Writeln('Rev ' + SCRIPT_VER)")
  784. [*] Added 5% chance to hover the magic skill every loop
  785. Revision 5QP:
  786. [*] Changed color tolerance when searching for seaweed from 2 to 3
  787. Revision 6:
  788. [*] Added: procedure Debug(What: string; Levels: Integer);
  789. [*] Added debugging lines to all/most functions.
  790. Revision 7:
  791. [*] Changed OpenVWBank to sort the TPA from the center of the screen before
  792. splitting it to an ATPA
  793. [*] both withdrawing functions now record the last known bank index to use
  794. in case the bank index isn't found, so then the index is set to the last
  795. known.
  796. [*] Changed length check (90 ==> 60)
  797. [*] Removed script setup info from top of the script, see the thread if you
  798. need to.
  799. Revision 8:
  800. [*] Replaced CountGlass with Count(Which: Integer), and made it work for
  801. glass, seaweed, and sand.
  802. [*] Added AttemptAndSwivel(Func: function: Boolean; Attempts, SwivelPer: Integer)
  803. [*] Modified main loop to open the bank via AttemptAndSwivel
  804. [*] Modified DepositGlass to work for all 3 items.
  805. [*] New function WithdrawMaterials for failsafing, attempts withdrawing 5 times;
  806. replaced the individual functions being used in the main loop.
  807. [*] Merged WithdrawSeaweed and WithdrawSand to WithdrawItem(Which: Integer): Boolean;
  808. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement