Advertisement
CALEMXS

boo's script

Nov 13th, 2014
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.87 KB | None | 0 0
  1. program boosFlaxSpinner;
  2. //{$DEFINE SMART} // Uncomment for SMART
  3. {$DEFINE SMART}
  4. {$I SRL-6/SRL.Simba}
  5. {$i srl-6/lib/misc/srlplayerform.simba}
  6.  
  7. procedure DeclarePlayers;
  8. begin
  9. HowManyPlayers := 1;
  10. NumberOfPlayers(HowManyPlayers);
  11. CurrentPlayer := 0;
  12. with Players[0] do
  13. begin
  14. Name := ''; // Username
  15. Pass := ''; // Password
  16. Nick := ''; // Nickname (3-4 unique characters from name
  17. Active := True; // Use this player (True/False)
  18. Integers[0] := 10000; // Number of flax to spin
  19. end;
  20. {
  21. with Players[1] do
  22. begin
  23. Name := ''; // Username
  24. Pass := ''; // Password
  25. Nick := ''; // Nickname (3-4 unique characters from name
  26. Active := True; // Use this player (True/False)
  27. Integers[0] := 1000; // Number of flax to spin
  28. end;
  29. }
  30. end;
  31.  
  32. const VERSION = 0.79;
  33. LVL_ERROR = 0;
  34. LVL_BANK = 1;
  35. LVL_SPIN = 2;
  36. LOC_ERROR = 0;
  37. LOC_STAIRS = 1;
  38. LOC_BANK = 2;
  39. LOC_SPIN = 3;
  40. GOTO_START = 0;
  41. GOTO_GOTFLAX = 1;
  42. GOTO_GOTBOWSTRINGS = 2;
  43. GOTO_ONLYDEPOSIT = 3;
  44. GOTO_FLAXSPIN = 4;
  45.  
  46. var FlaxDTM, BowStringDTM, StairsDTM, BankDTM, SpinningWheelDTM, JumpTo: Integer;
  47.  
  48. { Null variables }
  49. NullInt: Integer;
  50. NullTPA: TPointArray;
  51. NullT2DEA: T2DExtendedArray;
  52.  
  53. label Start, GotFlax, GotBowStrings, OnlyDeposit, FlaxSpin;
  54.  
  55. function GetRemoteVersion: Extended;
  56. begin
  57. Result := StrToFloat(Trim(GetPage('http://static.frement.net/srl/flaxspinner/version')));
  58. end;
  59.  
  60. procedure AutoUpdate;
  61. var NewData, OldData, AccountCredentials: String;
  62. FileHandle: Integer;
  63. begin
  64. if (GetRemoteVersion <= VERSION) then begin
  65. Writeln('Script version ' + FloatToStr(VERSION) + ' is up-to-date.');
  66. exit;
  67. end;
  68. NewData := Trim(GetPage('http://static.frement.net/srl/flaxspinner/data'));
  69. FileHandle := OpenFile(ScriptPath + 'FlaxSpinner.simba', False);
  70. ReadFileString(FileHandle, OldData, FileSize(FileHandle));
  71. CloseFile(FileHandle);
  72. AccountCredentials := Trim(Between('{$I SRL-OSR/SRL.simba}', 'const VERSION = ' + FloatToStr(VERSION) + ';', OldData));
  73. NewData := ReplaceWrap(NewData, '{%DECLARE_PLAYERS%}', AccountCredentials, []);
  74. FileHandle := RewriteFile(ScriptPath + 'FlaxSpinner.simba', False);
  75. try
  76. WriteFileString(FileHandle, NewData);
  77. except begin
  78. Writeln('Error updating script from remote. Terminating script...');
  79. CloseFile(FileHandle);
  80. TerminateScript;
  81. end;
  82. end;
  83. CloseFile(FileHandle);
  84. Writeln('Script has been updated to version ' + FloatToStr(GetRemoteVersion) + ', please reload script.');
  85. TerminateScript;
  86. end;
  87.  
  88. procedure ProgressReport;
  89. var I: Integer;
  90. begin
  91. Writeln('+----------------------------------------------+');
  92. Writeln('| Flax Spinner ver ' + Padr(FloatToStr(VERSION), 16) + '|');
  93. Writeln('+----------------------------------------------+');
  94. Writeln('| Time running: ' + Padr(TimeRunning, 31) + '|');
  95. Writeln('+----------------------------------------------+');
  96. for I := 0 to High(Players) do begin
  97. Writeln('| Player: ' + Padr(Players[CurrentPlayer].Nick, 37) + '|');
  98. Writeln('| - Trips made: ' + Padr(IntToStr(Players[CurrentPlayer].Integers[4]), 30) + '|');
  99. Writeln('| - Bow strings crafted: ' + Padr(IntToStr(Players[CurrentPlayer].Integers[5]), 21) + '|');
  100. Writeln('+----------------------------------------------+');
  101. end;
  102. end;
  103.  
  104. procedure AntiBan;
  105. begin
  106. case RandomRange(1, 20) of
  107. 1, 5, 12: MMouse(Random(173), Random(271), 3, 3);
  108. 3, 4, 16: Wait(98 + Random(31));
  109. 9: PickUpMouse;
  110. 19: RandomRClick;
  111. end;
  112. end;
  113.  
  114. procedure CountBowStrings;
  115. var I: Integer;
  116. CurrentBox: TBox;
  117. begin
  118. for I := 1 to 28 do begin
  119. CurrentBox := InvBox(I);
  120. if (FindDTM(BowStringDTM, NullInt, NullInt, CurrentBox.x1, CurrentBox.y1, CurrentBox.x2, CurrentBox.y2)) then
  121. Inc(Players[CurrentPlayer].Integers[5]);
  122. end;
  123. end;
  124.  
  125. function FindBlackChatMessageMulti(ChatMsg: TStringArray): Boolean;
  126. var I: Integer;
  127. begin
  128. for I := 0 to High(ChatMsg) do begin
  129. Result := (Pos(ChatMsg[I], GetChatBoxText(8, clMessage)) > 0);
  130. if (Result) then
  131. exit;
  132. end;
  133. end;
  134.  
  135. procedure SetupDTMs;
  136. begin
  137. FlaxDTM := DTMFromString('mFQEAAHic42VgYIgF4hAgjgbiFCBOAuJ4IA4F4nCoeBwQJwJxOhAnA3EgEPsCsRcU+0D5IPFgIA6D0iB+EBD7AzGDFQdD6LbdDOG79zNEHjgMpkFiyJgjjpeBww2obssOBg4vDgZdoDZSMSMZGAUAAD/wFqE=');
  138. BowStringDTM := DTMFromString('mKgEAAHicnctBCkBQFIXhawN2YiGSlxTPSsx5A6X0XhGW61d3wPSe+ganzslFJGLFgoAZO07cuHAgYdPdu3GqRoVSe4MWHXp4DB/T6E0KvhaZ0T8P3oshBQ==');
  139. StairsDTM := DTMFromString('mggAAAHicY2NgYGBmQAAQmw2I2YGYCYpZgZgFikEgQhGhHsSGYQ0gXxKKNZAwIw4MAQCyWgLn');
  140. BankDTM := DTMFromString('mVAEAAHicnc/BCoJQEIXhuWnpUtQSFwoikQu1cONT6Mr3fwM34QP03xxCojYe+DjcCzMwgYhc4MiaAC6O8HHSd4gMNW5IcICnc1c0eKBHh7tqUahI96Y4I4YxRv5lLNaen/Onp2F4s7G9MJ7Lb5V2uelq82/b6C17fecFL5gO6Q==');
  141. SpinningWheelDTM := DTMFromString('m5wEAAHicE2dgYJADYhYgZgVidiDmBGIuKBskBgOMQMwGleMHYiEgFoWKMQGxBJRtCcQ6QCwCxLxArAHE2lAxbShfHYgVoDRITB+IDYHYAIh1oeKqQCwJxJpQtgwQSyG5J8TXF0z7KUIwOhsf+PjuI178hRFitxEUo7PxYTcCmBEaXrTAOAAAWCUipw==');
  142. end;
  143.  
  144. function GetLevel: Integer;
  145. begin
  146. Result := LVL_ERROR;
  147. if (FindDTMsRotatedSE(BankDTM, NullTPA, MMX1, MMY1, MMX2, MMY2, -10.0, 10.0, 1.0, NullT2DEA)) then begin
  148. Result := LVL_BANK;
  149. end;
  150. if (FindDTMsRotatedSE(SpinningWheelDTM, NullTPA, MMX1, MMY1, MMX2, MMY2, -10.0, 10.0, 1.0, NullT2DEA)) then begin
  151. Result := LVL_SPIN;
  152. end;
  153. end;
  154.  
  155. function GetLocation: Integer;
  156. var Points: TPointArray;
  157. begin
  158. Result := LOC_ERROR;
  159. if (GetLevel = LVL_BANK) then
  160. if (FindDTMsRotatedSE(BankDTM, Points, MMX1, MMY1, MMX2, MMY2, -10.0, 10.0, 1.0, NullT2DEA)) then begin
  161. SortTPAFrom(Points, Point(645, 165));
  162. if (Distance(Points[0].x, Points[0].y, MMCX, MMCY) <= 7) then
  163. Result := LOC_BANK
  164. else
  165. Result := LOC_STAIRS;
  166. end;
  167. if (GetLevel = LVL_SPIN) then
  168. if (FindDTMsRotatedSE(SpinningWheelDTM, Points, MMX1, MMY1, MMX2, MMY2, -10.0, 10.0, 1.0, NullT2DEA)) then begin
  169. SortTPAFrom(Points, Point(645, 165));
  170. if (Distance(Points[0].x, Points[0].y, MMCX, MMCY) <= 7) then
  171. Result := LOC_SPIN
  172. else
  173. Result := LOC_STAIRS;
  174. end;
  175. end;
  176.  
  177. function OpenLumbridgeBank: Boolean;
  178. var Colors: TPointArray;
  179. GlassATPA: T2DPointArray;
  180. MPoint: TPoint;
  181. I: Integer;
  182. begin
  183. Result := False;
  184. FindColorsTolerance(Colors, 8624291, MSX1, MSY1, MSX2, MSY2, 10);
  185. GlassATPA := TPAToATPAEx(Colors, 25, 8);
  186. SortATPAFrom(GlassATPA, Point(MSCX, MSCY));
  187. for I := 0 to High(GlassATPA) do begin
  188. MPoint := MiddleTPA(GlassATPA[I]);
  189. MMouse(MPoint.x, MPoint.y, 2, 2);
  190. ClickMouse2(Mouse_Right);
  191. if (ChooseOptionMulti(['Bank', 'Ban', 'ank'])) then
  192. break;
  193. end;
  194. WaitFunc(@BankScreen, 250, 1250);
  195. Result := BankScreen;
  196. end;
  197.  
  198. function HaveFlax: Boolean;
  199. begin
  200. Result := (FindDTM(FlaxDTM, NullInt, NullInt, MIX1, MIY1, MIX2, MIY2));
  201. end;
  202.  
  203. function HaveBowStrings: Boolean;
  204. begin
  205. Result := (FindDTM(BowStringDTM, NullInt, NullInt, MIX1, MIY1, MIX2, MIY2));
  206. end;
  207.  
  208. procedure WithdrawFlax;
  209. var ItemSlot: TPoint;
  210. X, Y: Integer;
  211. begin
  212. if (HaveFlax) and (InvFull) then
  213. exit;
  214. if (not BankScreen) then begin
  215. WaitFunc(@BankScreen, 500, 2500);
  216. if (not OpenLumbridgeBank) then
  217. OpenBankFast('lb');
  218. end;
  219. if (FindDTM(FlaxDTM, X, Y, MBX1, MBY1, MBX2, MBY2)) then begin
  220. ItemSlot := MSTPointToBankPoint(Point(X, Y));
  221. if (Withdraw(ItemSlot.x, ItemSlot.y, 0)) then
  222. CloseBank;
  223. end else
  224. NextPlayer(False);
  225. CloseBank;
  226. end;
  227.  
  228. procedure DepositBowStrings;
  229. var X, Y: Integer;
  230. begin
  231. if (not HaveBowStrings) then
  232. exit;
  233. CountBowStrings;
  234. Inc(Players[CurrentPlayer].Integers[4]);
  235. if (FindDTM(BowStringDTM, X, Y, MIX1, MIY1, MIX2, MIY2)) then begin
  236. if (not BankScreen) then begin
  237. WaitFunc(@BankScreen, 500, 2500);
  238. if (not OpenLumbridgeBank) then
  239. OpenBankFast('lb');
  240. end;
  241. MMouse(X, Y, 2, 2);
  242. ClickMouse2(Mouse_Right);
  243. if (WaitOptionMultiEx(['Store All', 're A','All','ll '], 'All', Nothing, 600)) then
  244. ChooseOptionMulti(['Store All', 're A','All','ll ']);
  245. end;
  246. end;
  247.  
  248. procedure WalkTo(Location: String);
  249. var DTM, Loc, WalkingMark: Integer;
  250. Points: TPointArray;
  251. begin
  252. MarkTime(WalkingMark);
  253. case Location of
  254. 'stairs': begin
  255. DTM := StairsDTM;
  256. Loc := LOC_STAIRS;
  257. end;
  258. 'bank': begin
  259. DTM := BankDTM;
  260. Loc := LOC_BANK;
  261. end;
  262. 'wheel': begin
  263. DTM := SpinningWheelDTM;
  264. Loc := LOC_SPIN;
  265. end;
  266. end;
  267. if (FindDTMsRotatedSE(DTM, Points, MMX1, MMY1, MMX2, MMY2, -22.5, 22.5, 0.5, NullT2DEA)) then begin
  268. SortTPAFrom(Points, Point(645, 165));
  269. if (Distance(Points[0].x, Points[0].y, MMCX, MMCY) >= 15) then begin
  270. MMouse(Points[0].x, Points[0].y, 1, 1);
  271. ClickMouse2(Mouse_Left);
  272. end;
  273. end else begin
  274. Writeln('Error walking to ' + Location + '. Terminating script.');
  275. TerminateScript;
  276. end;
  277. repeat
  278. Wait(250);
  279. until(not IsMoving) or (TimeFromMark(WalkingMark) >= 30000);
  280. if (not GetLocation = Loc) then
  281. WalkTo(Location);
  282. end;
  283.  
  284. procedure Climb(Up: Boolean);
  285. var Colors: TPointArray;
  286. StairsATPA: T2DPointArray;
  287. MPoint: TPoint;
  288. Texts: TStringArray;
  289. I: Integer;
  290. begin
  291. case Up of
  292. True: Texts := ['Climb-up', 'limb-u', 'up'];
  293. False: Texts := ['Climb-down', 'limb-d', 'down'];
  294. end;
  295. FindColorsTolerance(Colors, 537162, MSX1, MSY1, MSX2, MSY2, 20);
  296. StairsATPA := TPAToATPAEx(Colors, 15, 15);
  297. SortATPAFromFirstPoint(StairsATPA, Point(MSCX, MSCY));
  298. for I := 0 to High(StairsATPA) do begin
  299. MPoint := MiddleTPA(StairsATPA[I]);
  300. MMouse(MPoint.x, MPoint.y, 1, 1);
  301. ClickMouse2(Mouse_Right);
  302. if (ChooseOptionMulti(Texts)) then
  303. break;
  304. end;
  305. Wait(1500);
  306. end;
  307.  
  308. procedure SpinFlax(SkipLevelUp: Boolean);
  309. var Colors: TPointArray;
  310. WheelATPA: T2DPointArray;
  311. MPoint: TPoint;
  312. I, SpinningMark: Integer;
  313. begin
  314. if (not HaveFlax) then
  315. exit;
  316. MarkTime(SpinningMark);
  317. FindColorsTolerance(Colors, 14342879, MSX1, MSY1, MSX2, MSY2, 20);
  318. WheelATPA := TPAToATPAEx(Colors, 5, 5);
  319. SortATPAFromFirstPoint(WheelATPA, Point(MSCX, MSCY));
  320. for I := 0 to High(WheelATPA) do begin
  321. MPoint := MiddleTPA(WheelATPA[I]);
  322. MMouse(MPoint.x, MPoint.y, 1, 1);
  323. ClickMouse2(Mouse_Right);
  324. if (ChooseOptionMulti(['Spin', 'Spi', 'pin'])) then begin
  325. Wait(RandomRange(1250, 1750));
  326. MMouse(259, 110, 2, 2);
  327. ClickMouse2(Mouse_Right);
  328. ChooseOptionMulti(['Make X', 'ake X', ' X']);
  329. Wait(RandomRange(500, 750));
  330. TypeSendEx('9999', False);
  331. TypeSend('');
  332. repeat
  333. Wait(250);
  334. AntiBan;
  335. FindNormalRandoms;
  336. if (not SkipLevelUp) then
  337. if (LevelUp) then begin
  338. SpinFlax(True);
  339. exit;
  340. end;
  341. until(FindBlackChatMessageMulti(['out of flax', 't of f', 'f flax', 'run out of'])) or (TimeFromMark(SpinningMark) >= 90000);
  342. break;
  343. end;
  344. end;
  345. Wait(1500);
  346. end;
  347.  
  348. function ResetPlayer: Integer;
  349. begin
  350. if (GetLevel = LVL_BANK) then
  351. if (HaveFlax) then begin
  352. Result := GOTO_GOTFLAX;
  353. exit;
  354. end else if (HaveBowStrings) then begin
  355. Result := GOTO_ONLYDEPOSIT;
  356. exit;
  357. end;
  358. if (GetLevel = LVL_SPIN) then
  359. if (HaveBowStrings) then begin
  360. Result := GOTO_GOTBOWSTRINGS;
  361. exit;
  362. end else if (HaveFlax) then begin
  363. Result := GOTO_FLAXSPIN;
  364. exit;
  365. end;
  366. Result := GOTO_START;
  367. if (GetLevel = LVL_ERROR) or (GetLocation = LOC_ERROR) then
  368. NextPlayer(False);
  369. end;
  370.  
  371. procedure EndScript;
  372. begin
  373. ProgressReport;
  374. FreeDTMs([FlaxDTM, BowStringDTM, StairsDTM, BankDTM, SpinningWheelDTM]);
  375. end;
  376.  
  377. begin
  378. {$IFDEF SMART}
  379. SMART_FixSpeed := True;
  380. {$ENDIF}
  381. SetupSRL;
  382. DeclarePlayers;
  383. ActivateClient;
  384. AutoUpdate;
  385. SetupDTMs;
  386. AddOnTerminate('EndScript');
  387.  
  388. repeat
  389. repeat
  390. ProgressReport;
  391. if (not LoggedIn) then
  392. LoginPlayer;
  393. JumpTo := ResetPlayer;
  394. if (JumpTo = GOTO_START) then
  395. goto Start;
  396. if (JumpTo = GOTO_GOTFLAX) then
  397. goto GotFlax;
  398. if (JumpTo = GOTO_FLAXSPIN) then
  399. goto FlaxSpin;
  400. if (JumpTo = GOTO_GOTBOWSTRINGS) then
  401. goto GotBowStrings;
  402. if (JumpTo = GOTO_ONLYDEPOSIT) then
  403. goto OnlyDeposit;
  404. Start:
  405. WithdrawFlax;
  406. GotFlax:
  407. WalkTo('stairs');
  408. Climb(False);
  409. FlaxSpin:
  410. WalkTo('wheel');
  411. SpinFlax(False);
  412. GotBowStrings:
  413. WalkTo('stairs');
  414. Climb(True);
  415. OnlyDeposit:
  416. WalkTo('bank');
  417. DepositBowStrings;
  418. ProgressReport;
  419. until(Players[CurrentPlayer].Integers[5] >= Players[CurrentPlayer].Integers[0]);
  420. NextPlayer(False);
  421. until(AllPlayersInactive);
  422.  
  423. ProgressReport;
  424. LogOut;
  425. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement