Advertisement
OGL_Clutch

FireRunesScript

Feb 10th, 2016
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.68 KB | None | 0 0
  1. Program ClutchFireRunes;
  2. {$DEFINE SMART}
  3. {$i AeroLib/AeroLib.Simba}
  4. {$i Reflection/Reflection.Simba}
  5.  
  6. const
  7. USERNAME = '';
  8. PASSWORD = '';
  9. PIN = '';
  10. DEBUG = '0';
  11.  
  12. const
  13. scriptVersion = '1.0';
  14.  
  15. var
  16. myPlayer: TReflectLocalPlayer;
  17. invItem: TReflectInvItem;
  18. StartingRunecraftingXP, startingRunes, ring: Integer;
  19. InGameTimer: TReflectTimer;
  20.  
  21. {PROCEDURE -- ClutchDebug
  22. Purpose: Custom console debugging procedure.
  23. Comments: By Clarity.}
  24. procedure ClutchDebug(message: string);
  25. begin
  26. if DEBUG = '1' then
  27. writeln('ClutchFireRunes v' + scriptVersion + ' || ' + Reflect.Time.MsToTime((InGameTimer.ElapsedTime()), 3) + ' || ' + message)
  28. else
  29. exit;
  30. end;
  31.  
  32. Procedure ClutchReport;
  33. var
  34. RunecraftingXP: Integer;
  35. XPGained: Integer;
  36. Rune: TReflectInvItem;
  37. begin
  38. if DEBUG = '1' then
  39. begin
  40. exit;
  41. end
  42. else
  43. XPGained := MyPlayer.GetSkillExp(Skill_Runecrafting) - StartingRunecraftingXP;
  44. clearDebug;
  45. writeln('ClutchFireRunes v' + scriptVersion + ' || ' + Reflect.Time.MsToTime((InGameTimer.ElapsedTime()), 3) + ' || ' + 'Please leave enhancement requests, complaints, and progress reports on the forums!');
  46. writeln('XP Gained: ' + ToStr(XPGained));
  47. writeln('XP per hour: ' + ToStr(XPGained / (InGameTimer.ElapsedTime() / 3600000)));
  48. writeln('Rings used: ' + ToStr(ring));
  49. writeln('Rings used per hour: ' + ToStr(ring / (InGameTimer.ElapsedTime() / 3600000)));
  50. end;
  51.  
  52. function R_TileOnMS(Tile : TPoint; var OutputPoint : TPoint; x : integer = 0; y : integer = 0; z : integer = 0):boolean;
  53. var
  54. tempB : TBox;
  55. begin
  56. OutputPoint := TReflectionTiles.TileToMS(Tile, x, y, z);
  57. tempB := intToBox(MSX1, MSY1, MSX2, MSY2);
  58. result := PointInBox(OutputPoint, tempB);
  59. end;
  60.  
  61. procedure randomMouseInput(pnt:Tpoint; ranx, rany:integer);
  62. begin
  63. case random(3) of
  64. 0:humanMMouse(pnt, ranx, rany);
  65. 1:missMouse(pnt, ranx, rany);
  66. 2:mouse(pnt, ranx, rany, mouse_move);
  67. end;
  68. end;
  69.  
  70. function R_InteractTile(tile:Tpoint; action:string; x:integer = 0; y:integer = 0; z:integer = 0):boolean;
  71. var
  72. RSTile : TPoint;
  73. begin
  74. if R_TileOnMS(Tile, RSTile, x, y, z) then begin
  75. randomMouseInput(rsTile, 3, 3);
  76. if(Reflect.Text.IsUpText(action)) then
  77. begin
  78. FastClick(mouse_left);
  79. result := didClick(true, 1000);
  80. end
  81. else
  82. begin
  83. if TReflectionText.optionExists(action) then
  84. begin
  85. FastClick(mouse_right);
  86. result := Reflect.Text.chooseOption(action);
  87. end;
  88. if not result then
  89. randomMouseInput(Point(MSCX, MSCY), 500, 500);
  90. end;
  91. end;
  92. end;
  93.  
  94. Procedure getTile;
  95. var
  96. ourTile : TPoint;
  97. begin
  98. ourTile := Reflect.Tiles.getGlobalTile;
  99. clutchDebug('Point('+ IntToStr(OurTile.x) + ',' + IntToStr(OurTile.y) +')');
  100. end;
  101.  
  102. Function R_Click(textstr : string): boolean;
  103. begin
  104. FastClick(Mouse_Right);
  105. if ChooseOption(textstr) then
  106. begin
  107. FFlag(0);
  108. result := true;
  109. end else
  110. result := false;
  111. end;
  112.  
  113. function dismissAllRandoms : boolean;
  114. var
  115. i, j, me_indice:integer;
  116. _npcs:TReflectNPCArray;
  117. randoms:tstringarray;
  118. begin
  119. randoms := ['dunce', 'molly', 'niles', 'miles', 'giles', 'sandwich lady','drunken dwarf',
  120. 'highwayman', 'dr jekyll', 'cap''n hand', 'security guard', 'rick turpentine',
  121. 'mysterious old man', 'frog', 'null', 'mime', 'sergeant damien', 'freaky forester',
  122. 'strange plant', 'postie pete', 'tilt', 'flippa', 'leo', 'pillory guard', 'evil bob'];
  123. _npcs.GetAll;
  124. me_indice := TReflectLocalPlayer.GetPlayerIndex;
  125. for i:=0 to high(_npcs) do begin
  126. if (_npcs[i].getInteractingIndex = me_indice) then begin
  127. for j:=0 to high(randoms) do begin
  128. if (pos(randoms[j], lowercase(_npcs[i].getName)) > 0) then begin
  129. if R_InteractTile(_npcs[i].getTile, 'Dismiss', 0, 0, 50) then begin
  130. FFlag(0);
  131. sleep(500+random(2000));
  132. clutchDebug('Dismissed random: '+_npcs[i].getname+' Time Running: '+TimeRunning);
  133. result := True;
  134. end;
  135. end;
  136. end;
  137. end;
  138. end;
  139. end;
  140.  
  141. procedure AntiBanned;
  142. begin
  143. Reflect.Logger.Debug('Starting Antiban');
  144. case Random(8000) of
  145. 1: Reflect.Antiban.SleepAndMoveMouse(RandomRange(500, 2500));
  146. 2: Reflect.Antiban.RandomMovement();
  147. 3: Reflect.Antiban.CompassMovement(0, 360, False);
  148. 4: Reflect.Antiban.BoredHuman();
  149. 5: Wait(RandomRange(500, 5000));
  150. 6: Reflect.Antiban.ExamineInv();
  151. 7: Reflect.Antiban.PickUpMouse();
  152. 8: Reflect.Antiban.SleepAndMoveMouse(5000);
  153. end;
  154. end;
  155.  
  156. Procedure waitShort;
  157. begin
  158. wait(randomRange(100, 600));
  159. end;
  160.  
  161. Procedure waitLong;
  162. begin
  163. wait(randomRange(900,1200));
  164. end;
  165.  
  166. Function waitMove(c: Integer): boolean;
  167. var
  168. d : integer;
  169. Begin
  170. clutchDebug('Player is busy');
  171. antiBanned;
  172. random(4000);
  173. dismissAllRandoms;
  174. FFlag(0);
  175. (d = (c/5));
  176. wait(c+random(d));
  177. while myPlayer.IsAnimating or myPlayer.IsMoving do
  178. wait(c-random(d));
  179. end;
  180.  
  181. procedure TryLogin();
  182. var
  183. Timer: TReflectTimer;
  184. RandomTime: Integer;
  185. begin
  186. Timer.Restart();
  187. Reflect.Logger.Status('Trying to login');
  188. RandomTime := RandomRange(120000, 150000);
  189. while (not MyPlayer.IsLoggedIn()) do
  190. begin
  191. MyPlayer.Login();
  192. MyPlayer.Active := True;
  193. waitLong;
  194. if (Timer.ElapsedTime() > RandomTime) then
  195. begin
  196. Reflect.Logger.Fatal('Unable to Login');
  197. terminateScript();
  198. end
  199. end
  200. MyPlayer.Create();
  201. end;
  202.  
  203. Procedure teleArena;
  204. begin
  205. if myPlayer.isAnimating then
  206. exit;
  207. if itemInSlot(2) then
  208. begin
  209. interactSlot(2, mouse_right);
  210. Reflect.Text.ChooseOption('Rub');
  211. waitLong;
  212. sendKeys('1', 60, 0);
  213. waitLong;
  214. end
  215. else
  216. begin
  217. if getCurrentTab():=4 then
  218. begin
  219. typeByte(VK_F4);
  220. end
  221. begin
  222. TReflectionMouse.Move(700, 370, 710, 390, mouse_right);
  223. Reflect.Text.ChooseOption('Duel Arena');
  224. clutchDebug('teleported to Castle Wars');
  225. waitLong;
  226. if getCurrentTab():=5 then
  227. typeByte(VK_ESCAPE);
  228. end;
  229. end;
  230. antiBanned();
  231. end;
  232.  
  233. Procedure teleCW;
  234. begin
  235. if myPlayer.isAnimating then
  236. exit;
  237. if itemInSlot(2) then
  238. begin
  239. interactSlot(2, mouse_right);
  240. Reflect.Text.ChooseOption('Rub');
  241. waitLong;
  242. sendKeys('2', 60, 0);
  243. waitLong;
  244. end
  245. else
  246. begin
  247. if getCurrentTab():=4 then
  248. begin
  249. typeByte(VK_F4);
  250. end
  251. begin
  252. TReflectionMouse.Move(700, 370, 710, 390, mouse_right);
  253. Reflect.Text.ChooseOption('Castle Wars');
  254. clutchDebug('teleported to Castle Wars');
  255. waitLong;
  256. if getCurrentTab():=5 then
  257. typeByte(VK_ESCAPE);
  258. end;
  259. end;
  260. end;
  261.  
  262. Function OpenBank :boolean;
  263. var
  264. Bank: TReflectObject;
  265. begin
  266. clutchDebug('Opening Bank');
  267. waitMove(300);
  268. if TReflectionBank.IsOpen then
  269. begin
  270. exit;
  271. end;
  272. FFlag(0);
  273. if Bank.Find(objGame, 'Bank chest', 5) then
  274. begin
  275. Reflect.Mouse.Move(Bank.GetMSPoint, 5, 5);
  276. waitShort;
  277. R_Click('Use Bank chest');
  278. FFlag(0);
  279. end;
  280. end;
  281.  
  282. procedure WithdrawItems(item: String; amount: Integer; Result: Boolean);
  283. var
  284. iitem: TReflectBankItem;
  285. begin
  286. if iitem.Find(item) then
  287. begin
  288. waitMove(250);
  289. iitem.Withdraw(amount);
  290. waitLong;
  291. result := true;
  292. end
  293. else if not invItem.Find(item) then
  294. begin
  295. logoutPlayer;
  296. terminatescript;
  297. result := false;
  298. end;
  299. end;
  300.  
  301. function withDraw: Boolean;
  302. begin
  303. clutchDebug('Withdrawing Items');
  304. if invItem.Find('Ring of dueling(1)') then
  305. depositItem(2,1,100);
  306. if not itemInSlot(2) then
  307. begin
  308. clutchDebug('Withdrawing new ring');
  309. WithdrawItems('Ring of dueling(8)', 1, true);
  310. inc(ring);
  311. end;
  312. if not invitem.Find('Pure essence') then
  313. WithdrawItems('Pure essence', 28, true);
  314. Reflect.Bank.Close;
  315. teleArena;
  316. end;
  317.  
  318. Function cRuins(C: Integer): boolean;
  319. begin
  320. if Reflect.Tiles.DistanceFromTile(Point(3309,3251)) < C then
  321. begin
  322. if myPlayer.IsAnimating or myPlayer.IsMoving then
  323. begin
  324. exit;
  325. end;
  326. if R_InteractTile(Point(3312+RandomRange(0,2),3254+RandomRange(0,2)), 'Mysterious ruins', 1, 1, C) then
  327. begin
  328. clutchDebug('Clicking Ruins');
  329. waitLong;
  330. result := true;
  331. end;
  332. end;
  333. waitLong;
  334. end;
  335.  
  336. Function cAltar(C: Integer): boolean;
  337. begin
  338. if Reflect.Tiles.DistanceFromTile(Point(2585,4838)) < C then
  339. begin
  340. if myPlayer.IsAnimating or myPlayer.IsMoving then
  341. begin
  342. exit;
  343. end;
  344. if not TReflectionInventory.isFull() then
  345. begin
  346. teleCW;
  347. exit;
  348. end;
  349. if R_InteractTile(Point(2585+RandomRange(0,2),4838+RandomRange(0,2)), 'Craft-rune Altar', 1, 1, C) then
  350. begin
  351. clutchDebug('Crafting runes');
  352. waitLong;
  353. result := true;
  354. end;
  355. end;
  356. end;
  357.  
  358. Procedure WalkBank;
  359. begin
  360. if myPlayer.IsAnimating or myPlayer.IsMoving then
  361. begin
  362. exit;
  363. end;
  364. if(getRunEnergy >= (40 +random(40))) and not isUsingRun then
  365. begin
  366. toggleRunning(true);
  367. end;
  368. if Reflect.Tiles.DistanceFromTile(Point(2444,3083)) > 15 then
  369. begin
  370. exit;
  371. end;
  372. if Reflect.Tiles.DistanceFromTile(Point(2444,3083)) > 3 then
  373. begin
  374. myPlayer.BlindWalkMM (Point(2444+RandomRange(0, 2),3083+RandomRange(0, 2)),2);
  375. clutchDebug('Walking to Bank');
  376. waitShort;
  377. end;
  378. end;
  379.  
  380. Procedure WalkAltar;
  381. begin
  382. if myPlayer.IsAnimating or myPlayer.IsMoving then
  383. begin
  384. exit;
  385. end;
  386. if(getRunEnergy >= (40 +random(40))) and not isUsingRun then
  387. begin
  388. toggleRunning(true);
  389. end;
  390. if Reflect.Tiles.DistanceFromTile(Point(2584,4840)) > 20 then
  391. begin
  392. exit;
  393. end;
  394. if Reflect.Tiles.DistanceFromTile(Point(2584,4840)) > 5 then
  395. begin
  396. myPlayer.BlindWalkMM (Point(2584+RandomRange(0, 2),4840+RandomRange(0, 2)),2);
  397. clutchDebug('Walking to Altar');
  398. waitShort;
  399. end;
  400. end;
  401.  
  402. Procedure WalkRuins;
  403. begin
  404. if myPlayer.IsAnimating or myPlayer.IsMoving then
  405. begin
  406. exit;
  407. end;
  408. if(getRunEnergy >= (40 +random(40))) and not isUsingRun then
  409. begin
  410. toggleRunning(true);
  411. end;
  412. if Reflect.Tiles.DistanceFromTile(Point(3311,3253)) > 30 then
  413. begin
  414. exit;
  415. end;
  416. if Reflect.Tiles.DistanceFromTile(Point(3311,3253)) > 5 then
  417. begin
  418. myPlayer.BlindWalkMM (Point(3311+RandomRange(0, 1),3253+RandomRange(0, 1)),2);
  419. clutchDebug('Walking to Ruins');
  420. waitShort;
  421. end;
  422. end;
  423.  
  424. Procedure mainLoop;
  425. begin
  426. if myPlayer.isMoving or myPlayer.isAnimating then
  427. waitMove(60)
  428. else if TReflectionBank.isOpen then
  429. withdraw
  430. else if Reflect.Tiles.DistanceFromTile(Point(2444,3083)) < 3 then
  431. openBank
  432. else if Reflect.Tiles.DistanceFromTile(Point(3311,3253)) < 5 then
  433. cRuins(15)
  434. else if Reflect.Tiles.DistanceFromTile(Point(2584,4840)) < 5 then
  435. cAltar(15)
  436. else if not invItem.Find('Pure essence') then
  437. walkBank
  438. else if Reflect.Tiles.DistanceFromTile(Point(3312,3252)) < 30 and TReflectionInventory.IsFull() then
  439. walkRuins
  440. else if Reflect.Tiles.DistanceFromTile(Point(2584,4840)) < 30 and TReflectionInventory.IsFull() then
  441. walkAltar;
  442. end;
  443.  
  444. begin
  445. initAL;
  446. Reflect.Setup;
  447. myPlayer.Username := USERNAME;
  448. myPlayer.Password := PASSWORD;
  449. myPlayer.Pin := PIN;
  450. myPlayer.Active := True;
  451. SMART_ShowConsole := false;
  452. tryLogin();
  453. setCompass('Random');
  454. setAngle(ANGLE_HIGH);
  455. StartingRunecraftingXP := myPlayer.GetSkillExp(SKILL_RUNECRAFTING);
  456. InGameTimer.Start();
  457. begin
  458. repeat
  459. mainLoop;
  460. ClutchReport;
  461. until (false);
  462. end;
  463. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement