zamaro

Fcurser latest

Apr 4th, 2014
292
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 65.85 KB | None | 0 0
  1. {*+++++++++++++*}
  2. {+ Insructions +}
  3. {+ To Hide The Instructions Press the Minus '-' on the first line +}
  4. {+ Be sure to do your setup correctly! +}
  5. {*+++++++++++++*}
  6.  
  7. {*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*
  8. ================================================================================
  9. A|(InGame-Setup)
  10.  
  11. A1) Brightness to highest | Auto retaliate on.
  12. A2) You can start either Logged-in or Logged-Out outside the cave.
  13. A3) Inside the cave you can only start either logged out - or at safe spot.
  14. A3.B) If you are using reflection then you must always start logged out!!!.
  15. A4) Equip the following: Ring of life, Magic staff or Mud battle staff.
  16. A5) Have body runes and teleport runes or teleport Tab in your inventory.
  17. A6) Have -65 Mage bonus for your magic attack; Full Metal Armor + Dragon Vambs.
  18. ______________________________________________________________________________
  19. B|(Script-Setup)
  20.  
  21.  
  22. B1) you need the SRL-OSR include and Smart8.
  23. B2) If smart is already opened, pair it up before you launch the script.
  24. B3) Redefine your player settings to your choice.
  25. B4) If you launched and got an error, paste it at: http://ilya.xxx/ssf/
  26. ________________________________________________________________________________
  27. ================================================================================
  28. {Start of the script}
  29.  
  30. program FCurser;
  31. {$DEFINE SMART8}
  32. {$I SRL-OSR/SRL.Simba}
  33. {$I SRL-OSR/SRL/Reflection/Reflection.simba}
  34. {$i SRL-OSR\SRL\misc\debug.simba}
  35. {$i SRL-OSR\SRL\misc\SmartGraphics.simba}
  36.  
  37. var
  38. caveEntranceWhite: TIntegerArray;
  39. Messedup, Failcast, Timer, cast, CaveEntrances: integer;
  40. TimeTillBreak: string;
  41. MyPosition: tpoint;
  42.  
  43. const
  44. {
  45. ________________________________________________________________________________
  46. ================================================================================
  47. ________________________________________________________________________________
  48.  
  49. Section.1 : Player-Setup
  50. Section.2 : Advanced-Script-Setup
  51. ________________________________________________________________________________
  52.  
  53.  
  54. {++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++|
  55. |1. Prayer Setup |
  56. |++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
  57.  
  58. UseReflection = false; // Do you want the script to use Reflection?
  59. TermCheck = true; // If errors compile, it allows for termination.
  60.  
  61.  
  62.  
  63. debuginfo = false; //adds debug testing to script, text in debugger.
  64.  
  65. Username = 'zezima';// Your Username.
  66. Password = 'iscool';// Your Password. (Four letters, do not use first letters)
  67. Nickname = 'ezim'; // Your Nickname. (Important to set up proper nickname)
  68. // Script will detect talking randoms inside cave.
  69. //Review end of post:villavu.com/forum/showthread.php?t=5410
  70.  
  71. MainMouseSpeed = 11; // Script changes mouse speed, search MouseSpeedz
  72. // 10-15 should be good enough.
  73.  
  74. AttempSolvingRandoms = true; //If somehow you spawned outside the cave would you
  75. //Want the script to handle randoms if you get any?
  76. //Or just ignore them and re-enter cave?.
  77. //This also includes Detecting Jmods/PMods.
  78.  
  79.  
  80. Playermode = 1; // Three player modes: (1) is same as (2) in all features,
  81. // but it has random wait times after it does the click.
  82. // two is pretty much bot like, no major wait times after
  83. // clicking, no antiban either. Use (1) only please.
  84.  
  85. Breakhandler = true; // Would you like for the script to take breaks?
  86. BreakTime1 = 45; // Minimum Gameplay time before breaks.
  87. BreakTime2 = 120; // Maximum Gameplay Time before breaks.
  88. // Time is in Minutes, not MS.
  89.  
  90. BreakWait1 = 15; // For how long to take each break?
  91. BreakWait2 = 30; // Example 15, 30 will take a break for 15-30 minutes.
  92.  
  93.  
  94. TheMagicWord = 'ody'; // This is the WORD that confirms that you've ran out of
  95. // Runes, for example 'ody' refers to the word (Body)
  96. // Once said word appears in your chat box, the script
  97. // Will log out and terminate, this really depends on
  98. // What staff/runes you're using, don't use first letters.
  99.  
  100.  
  101. DoSmartProgress = false; // This will Draw a Debugged GUI on the Smart-Screen.
  102. // Displaying Time Running and Spells Cast, more CPU!.
  103. // recommended to leave off, MORE CPU = more Missclicks
  104.  
  105. SkillFailsafe = True; // This will Close the Skill Screen and range enchant
  106. // Screens if they get opened.
  107.  
  108. CheckChatTabAll = True; // This will make sure your Chat Tab is always on (ALL)
  109. // In order to register that you ran out of runes
  110. // The script needs to read the sentence in the chabox.
  111. // Disable this if you use the script while talking to
  112. // your friends in Clanchat or PM.
  113.  
  114.  
  115. {++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++|
  116. |2. Advanced Setup |
  117. |++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
  118.  
  119.  
  120. {++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++|
  121. |2. Advanced Setup |
  122. |++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
  123.  
  124.  
  125. EntranceMode = 2; // This is the entrance mode for cave, choices: 1,2 and 3.
  126. // Recommended you use (2), mode (1)/(3) can lead to out of
  127. // range error, (1) won't hover players, (3) does, use (2).
  128.  
  129. MAttMode = 1; // This determines which attack mode you want to use for
  130. // Monsters, default is (1) but if it gives you out of range
  131. // Errors then use (2).
  132.  
  133. RunToNPC = true; // if enabled (helpful) it will run to the NPC, now pay
  134. // attention carefully, it wont click on the NPC dot its self
  135. // but it will run Midpath, so you have to determin how close
  136. // or far you want your character to run, continue reading..
  137. // i find this useful because if it fails to allign correctly
  138. // it will still attempt to at least run to the npc.
  139.  
  140. MinNPCdistance = 0; // This triggers the running, if the script cant find the
  141. MaxNPCdistance = 20;// NPC in this distance - default 0-15 which means 2 squares
  142. // in pixel distance on RS mainsscreen (2 character moves)
  143. // So.. If it can't find the Dot in the designated distance
  144. // it will run, using the distance you set up for NpcRadius.
  145.  
  146. MinNPCRadius = 10; // This will determin what distance range can an NPC dot
  147. MaxNPCRadius = 70; // be on the minimap screen for it to be valid as a dot.
  148. // 10-70 scans the hole minimap for NPC dots, now this wont
  149. // trigger the run. I repeat, this won't click on the dot
  150. // its self, it clicks midway, to the path.
  151.  
  152.  
  153.  
  154. MaxNpcTime = 8000; // Maximum amount of time the script will look for the 45.
  155. // while you're at the safe spot and not in combat, if this
  156. // passes and it still cant find him, the script will log
  157. // out and then log back in (restarting safe spot process).
  158.  
  159.  
  160. AutoBankMM = false; // Detects Bank Symbol on the Mini-map using CTS2/Hue/Sat
  161. // This has been revised and no longer causes memory
  162. // leaks or CPU hogs (shouldn't if it does...)
  163. // if this fails then try other options, remember set your
  164. // brightness to HIGHEST!, also you can take the colors
  165. // i added then put them in AutoColorAid and add on the
  166. // new bankIcon colors to the existing color, i obtained
  167. // my color by starting/restarting RS about 34 times.
  168.  
  169. Autobankmm2 = true; // Highly recommend using this if your PC can handle it
  170. // it searches using (Findsymbols) function = Bitmaps
  171.  
  172. ManualBankMM = false; // If AutoBankMM/2 fails to find Bank/Icons then enable
  173. // This action and set up your own bank MM colors.
  174. // This also looks for a bitmap i made.
  175.  
  176.  
  177. { Guide to setting up manual bank MM:
  178. http://villavu.com/forum/showthread.php?t=101113&page=4&p=1228404#post1228404 }
  179.  
  180. BankMMColor1 = 4046813;
  181. BankMMColor2 = 3378855; // If manualBankMM is true, then edit it here.
  182. BankMMColor3 = 86633;
  183. BankMMTolerance = 5;
  184.  
  185. BankMMCTS = 1; //
  186. BankMMHue = 0.2; // Only change these using AutoColorAid!
  187. BankMMSat = 0.2; //
  188.  
  189.  
  190.  
  191. WaitMemory1 = 150; // This is how fast/slow the script will go through
  192. WaitMemory2 = 155; // The main loop, this is great for Memory/CPU hogs.
  193. // you can set this maximum to 400-405, anything higher
  194. // Pretty much defeats the purpose of botting.
  195.  
  196.  
  197. UseLessMemory = false; // Well this adds even more wait time, instead of just
  198. WaitMemory3 = 40; // Adding it at the start of all loops, this is inbetween
  199. WaitMemory4 = 55; // Most procedures, so we're talking about X15~ commands.
  200. // Anything really higher than 50 will make it slow.
  201. // However, this can work magics for memory/cpu leaks.
  202.  
  203. OutFailSafe = true; // Enable this if you want Outside Cave Failsafes.
  204. // You will need lumbridge teleport runes, this failsafe
  205. // will teleport you to lumbridge if you Cant enter
  206. // Caves for the duration of HpBarOutside and in combat.
  207.  
  208. HpBarOutside = 20000; // For how long the script will try to enter the cave,
  209. // Once this passes the script will teleport you and end.
  210. // Do note, this counter only starts if you - or some one
  211. // right next to you is in combat outside the cave.
  212.  
  213. //Granted i could use the ORB functionality in here, but honestly.. Am only doing this for SRL membership app.
  214. // Revising it even though there is a 100% chance i will NEVR use this script on a consistent basis (i have my own spot to train mage, if you actually read comments.. Pm me for script! its awesome!.
  215.  
  216.  
  217. LowHpOutside = 50; // So at what HP should register that its time to tele?
  218. // Change this if you have Low Hp levels, script will
  219. // take it as if you got in combat, got stuck outside,
  220. // reached low hp and then it decided to teleport to save
  221. // your runes.
  222.  
  223.  
  224.  
  225. CaveCTS = 2; // These settings detect the cave entrance from every
  226. CaveColor = 9737631; // Every angle.
  227. Cavetol = 27; // Change them ONLY IF YOUR USING AUTO COLOR AID!
  228. CaveHue = 0.07; // IF YOU KNOW WHAT AUTO COLOR AID, then i need not
  229. CaveSat = 0.09; // explain any further!
  230.  
  231.  
  232. BankIconColor = 2138555;
  233. BankIconTol = 25; // These colors took around 60 world hops & 50 simba restarts to gather..
  234. BankIconHue = 0.11; // Surely wasn't easy but they are not stable, when the game colors are too bright - npc's will be read as bank icons as well..
  235. BankIconSat = 1.15;
  236.  
  237. version = '1.4';
  238. Curse = 29;
  239.  
  240. procedure playerSetup;
  241. begin
  242. HowManyPlayers := 1; // How many players are you using?
  243. NumberOfPlayers(HowManyPlayers);
  244. CurrentPlayer := 0;
  245. With Players[0] Do // What are the preferences for each player?
  246. Begin
  247. Name := Username;
  248. Pass := Password;
  249. Nick := Nickname;
  250. LampSkill := Skill_Herblore;
  251. Active := True;
  252. End;
  253. caveEntranceWhite := [7763583, 8553356]; // Sean's cave color, works well! nice back up to have if all other colors break!
  254. end;
  255.  
  256.  
  257. {Credits to SRL OSR Dev Team, i just added the Green Color to locate magic}
  258.  
  259. function GetGreenUptext: string;
  260. var
  261. WhiteT, BlueT, YellowT, OrangeT, GreenT, FoundText: string;
  262. begin
  263. WhiteT := GetTextAtExWrap(8, 8, 80, 21, 0, 5, 1, 14541281, 55, 'UpChars07');
  264. BlueT := GetTextAtExWrap(35, 8, 150, 21, 0, 5, 1, 13423640, 65, 'UpChars07');
  265. YellowT := GetTextAtExWrap(35, 8, 150, 21, 0, 5, 1, 1235160, 40, 'UpChars07');
  266. OrangeT := GetTextAtExWrap(35, 8, 150, 21, 0, 5, 1, 4687583, 53, 'UpChars07');
  267. GreenT := GetTextAtExWrap(8, 8, 150, 21, 0, 5, 1, 120577, 65, 'UpChars07');
  268. FoundText := WhiteT + ' ' + BlueT + YellowT + OrangeT + GreenT;
  269. FoundText := ReplaceWrap(FoundText, '.', '', [rfReplaceAll]);
  270. FoundText := ReplaceWrap(FoundText, '/', '', [rfReplaceAll]);
  271. FoundText := ReplaceWrap(FoundText, '\', '', [rfReplaceAll]);
  272. FoundText := ReplaceWrap(FoundText, ',', '', [rfReplaceAll]);
  273. FoundText := ReplaceWrap(FoundText, '*', '', [rfReplaceAll]);
  274. FoundText := ReplaceWrap(FoundText, '^', '', [rfReplaceAll]);
  275. FoundText := ReplaceWrap(FoundText, '"', '', [rfReplaceAll]);
  276. Result := FoundText;
  277. end;
  278.  
  279. {had to add this, so the command wouldn't break, only added green color}
  280.  
  281. function IsUpTextMultiCustom2(Text: TStringArray): Boolean;
  282. var
  283. TheText: string;
  284. i, n: Integer;
  285. begin
  286. TheText := GetGreenUptext;
  287. n := High(Text);
  288. for i := 0 to n do
  289. if (Pos(Text[i], TheText) > 0) then
  290. begin
  291. Result := True;
  292. Exit;
  293. end;
  294. end;
  295.  
  296. {Same as above}
  297. function WaitUpTextMulti2(S: TStringArray; Time: Integer): Boolean;
  298. var
  299. T: Integer;
  300. begin
  301. Result := false;
  302. T := GetSystemTime + Time;
  303. while (GetSystemTime < T) do
  304. begin
  305. if (IsUpTextMultiCustom2(S)) then
  306. begin
  307. Result := True;
  308. Exit;
  309. end;
  310. Wait(20 + Random(20));
  311. end;
  312. end;
  313.  
  314. {This is modified so it won't click the Inventory tab to find the random events, it will just locate the text then start the normal findnormal randoms, we can't have it constantly click tabs between mage/inv.
  315.  
  316. Credits to SRL - OSRS include dev team!}
  317. function FindTalk2: Boolean;
  318. var
  319. ax, ay, yCount, zCount, Count2, x1, y1, x2, y2, Count1, bmpScreen: Integer;
  320. begin
  321. Result := False;
  322. if (GetArrayLength(Players) < 1) then
  323. Exit;
  324. if FindColor(ax, ay, 65535, MSX1, MSY1, MSX2, MSY2) then
  325. begin
  326. SetArrayLength(gtalksBox, 0);
  327. SetArrayLength(YelSkipBoxs, 0);
  328. y1 := ay;
  329. if ((ay + 5) > 334) then
  330. y2 := 334
  331. else
  332. y2 := ay + 5;
  333. x1 := ax;
  334. x2 := x1;
  335. zCount := 0;
  336. repeat
  337. if FindColor(ax, ay, 65535, x2, y1 + 2, x2 + 3, y2 + 3) then
  338. zCount := 0
  339. else
  340. zCount := zCount + 1;
  341. if (zCount = 4) then
  342. Break;
  343. x2 := x2 + 3;
  344. until (x2 + 3 > 515);
  345. if (x2 + 3 <= 515) then
  346. x2 := x2 - 12;
  347. if (x2 - x1 >= length(Players[CurrentPlayer].Nick) * 4) then
  348. begin
  349. x1 := x1 - 8;
  350. y1 := y1 - 8;
  351. x2 := x2 + 8;
  352. y2 := y2 + 8;
  353. if (x1 < 0) then
  354. x1 := 0;
  355. if (y1 < 0) then
  356. y1 := 0;
  357. if (x2 > 515) then
  358. x2 := 515;
  359. if (y2 > 334) then
  360. y2 := 334;
  361. Count2 := Count2 + 1;
  362. Count1 := Count1 + 1;
  363. SetArrayLength(gtalksBox, Count2);
  364. gtalksBox[Count2 - 1].x1 := x1;
  365. gtalksBox[Count2 - 1].y1 := y1;
  366. gtalksBox[Count2 - 1].x2 := x2;
  367. gtalksBox[Count2 - 1].y2 := y2 + 6;
  368. SetArrayLength(YelSkipBoxs, Count1);
  369. YelSkipBoxs[Count1 - 1].x1 := x1;
  370. YelSkipBoxs[Count1 - 1].y1 := y1;
  371. YelSkipBoxs[Count1 - 1].x2 := x2;
  372. YelSkipBoxs[Count1 - 1].y2 := y2;
  373. end
  374. else
  375. begin
  376. y1 := y1 - 2;
  377. y2 := y2 + 8;
  378. x1 := x1 - 5;
  379. x2 := x2 + 5;
  380. if (x1 < 0) then
  381. x1 := 0;
  382. if (y1 < 0) then
  383. y1 := 0;
  384. if (x2 > 515) then
  385. x2 := 515;
  386. if (y2 > 334) then
  387. y2 := 334;
  388. Count1 := Count1 + 1;
  389. SetArrayLength(YelSkipBoxs, Count1);
  390. YelSkipBoxs[Count1 - 1].x1 := x1;
  391. YelSkipBoxs[Count1 - 1].y1 := y1;
  392. YelSkipBoxs[Count1 - 1].x2 := x2;
  393. YelSkipBoxs[Count1 - 1].y2 := y2;
  394. end;
  395. if (GetArrayLength(gtalksBox) <> 0) then
  396. begin
  397. for yCount := 0 to GetArrayLength(gtalksBox) - 1 do
  398. begin
  399. if FindBitmapMaskTolerance(NickNameBMP, ax, ay, gtalksBox[yCount].x1, gtalksBox[yCount].y1, gtalksBox[yCount].x2, gtalksBox[yCount].y2, 0, 40) then
  400. begin
  401. WriteLn('Found NickName');
  402. ax := (gtalksBox[yCount].x2 + gtalksBox[yCount].x1) shr 1;
  403. ay := gtalksBox[yCount].y2 - 2;
  404. if gTalkSaveBitmap then
  405. begin
  406. bmpScreen := BitmapFromString(515, 334, '');
  407. CopyClientToBitmap(bmpScreen, 1, 1, 515, 334);
  408. if (gtalksBox[yCount].x1 = 0) then
  409. x1 := 1
  410. else
  411. x1 := gtalksBox[yCount].x1;
  412. if (gtalksBox[yCount].y1 = 0) then
  413. y1 := 1
  414. else
  415. y1 := gtalksBox[yCount].y1;
  416. gTalksCount := gTalksCount + 1;
  417. for Count1 := - 1 to 1 do
  418. for Count2 := - 1 to 1 do
  419. FastSetPixel(bmpScreen, Count1 + x1, Count2 + y1, 255);
  420. if (gtalksBox[yCount].x2 = 515) then
  421. x1 := 515
  422. else
  423. x1 := gtalksBox[yCount].x2;
  424. if (gtalksBox[yCount].y2 = 334) then
  425. y1 := 334
  426. else
  427. y1 := gtalksBox[yCount].y2;
  428. for Count1 := - 1 to 1 do
  429. for Count2 := - 1 to 1 do
  430. FastSetPixel(bmpScreen, Count1 + x1, Count2 + y1, 255);
  431. for Count1 := - 1 to 1 do
  432. for Count2 := - 1 to 1 do
  433. FastSetPixel(bmpScreen, Count1 + ax, Count2 + ay, 255);
  434. SaveBitmap(bmpScreen, ScriptPath + 'FTalk' + IntToStr(gTalksCount) + '.bmp');
  435. FreeBitmap(bmpScreen);
  436. end;
  437. Result := True;
  438. Exit;
  439. end;
  440. end;
  441. end;
  442. end;
  443. end;
  444.  
  445. {If a user has a slower pc then its nice to have the script slow down while it cycles through the commands}
  446. procedure Waitmore;
  447. begin
  448. if (UseLessMemory = true) then
  449. begin
  450. wait(randomrange(waitMemory3, WaitMemory4));
  451. end;
  452. end;
  453.  
  454. procedure StartTime;
  455. begin // generates a random time for breaking, after a break is done this command is run again to generate next break time.
  456. Timer := GetTimeRunning + RandomRange(BreakTime1 * 60000, BreakTime2 * 60000);
  457. end;
  458.  
  459. {Termination makes sure we end our script at any cost, it still tries to end it safely first and if that fails, it ends it regardless}
  460. procedure Termination(const Status: string);
  461. begin
  462. if (TermCheck = false) then // Users can Enable/disable termination checks
  463. exit;
  464. writeln(Status); // Prints our reason for termination
  465. if loggedin then // if we're logged in, it will log us out.
  466. begin
  467. if WaitFunc(@ LogOut, 500, RandomRange(8000, 20000)) then // waits for the script to log out.
  468. terminatescript
  469. else
  470. terminatescript; // if it doesn't manage to log out, it ends anyway
  471. end else
  472. terminatescript; // and if we're not loggedin it ends.
  473. end;
  474.  
  475. function LogMeOut: boolean;
  476. begin
  477. writeln('Logging out..');
  478. if WaitFunc(@ LogOut, 500, RandomRange(8000, 20000)) then
  479. begin //Logging out is buggy right now on OSRS, it needs some extra time
  480. writeln('We have managed to log out');
  481. result := true;
  482. end else //ends script if we fail to logout
  483. termination('We have failed to log out, ending script');
  484. end;
  485.  
  486. procedure TakeBreaks;
  487. var
  488. T, BreakTimer: integer;
  489. begin
  490. if (BreakHandler = false) then
  491. Exit;
  492. if (GetTimeRunning >= Timer) then // Checks if its time to break
  493. begin
  494. BreakTimer := Randomrange(BreakWait1 * 60000, BreakWait2 * 60000); // Calculates a time to break for
  495. MarkTime(T);
  496. writeln('It is time to take a break');
  497. WriteLn('Breaking for: ' + (MsToTime(BreakTimer, Time_Formal)));
  498. if LogMeOut then
  499. begin
  500. while (TimeFromMark(T) < BreakTimer) do // Credits & Props to P1ng for proper formating advise!
  501. Wait(RandomRange(1500, 2500)); // wait time is important so Simba can cycle throug the memory slowly without causing CPU leaks
  502. WriteLn('Completed break, re-starting script');
  503. StartTime; // Calculates next break's timer.
  504. end else // if it fails to log out then script ends.
  505. termination('We have failed to log out for our break, ending script');
  506. end;
  507. end;
  508.  
  509.  
  510.  
  511. {All of this is an example to demonstrate that there are other ways to do color location functionalities}
  512.  
  513. Type TCColor = record // initially i thought of just making an object record..
  514. Name : String; // So i'll just do one as an example.
  515. Tol,Color : integer;
  516. Hmod, Smod : extended;
  517. end;
  518.  
  519. Var
  520. TColors1: TCColor;
  521.  
  522. Procedure SetupExampleRecord();
  523. begin
  524. with TColors1 do
  525. begin
  526. Name := 'RangeSkill';
  527. Color:= 5334901;
  528. Tol := 12;
  529. HMod := 0.05;
  530. SMod := 0.41;
  531. end;
  532. end;
  533.  
  534.  
  535. {Using Records/Colors}
  536. Function ColorLocateTest(Color,Tol: integer; Hmod,Smod:extended): boolean;
  537. var
  538. tmpcts: Integer;
  539. TPA: Tpointarray;
  540. begin
  541. tmpcts := GetColorToleranceSpeed;
  542. ColorToleranceSpeed(2);
  543. SetColorSpeed2Modifiers(Hmod, Smod);
  544. result := FindColorsTolerance(TPA, Color, Msx1, Msy1, MSx2, Msy2, Tol);
  545. ColorToleranceSpeed(tmpcts);
  546. SetColorSpeed2Modifiers(0.2, 0.2);
  547. end;
  548.  
  549.  
  550.  
  551.  
  552.  
  553.  
  554. {Or we can do Case String Method, which i found much easier than making record per object}
  555. Function ColorLocate(what: string): boolean;
  556. var
  557. CTS: Integer;
  558. I, TPA: Tpointarray;
  559. begin
  560. cts := GetColorToleranceSpeed;
  561. ColorToleranceSpeed(2);
  562. case What of
  563. 'RangeScreen':
  564. begin
  565. SetColorSpeed2Modifiers(0.05, 0.41);
  566. FindColorsTolerance(TPA, 5334901, 482, 36, 492, 45, 12);
  567. end;
  568. 'SkillSCreen':
  569. begin
  570. SetColorSpeed2Modifiers(0.02, 1.48);
  571. FindColorsTolerance(TPA, 8042720, 480, 5, 513, 35, 4);
  572. end;
  573. 'NotChatTabAll':
  574. begin
  575. SetColorSpeed2Modifiers(0.10, 0.34);
  576. FindColorsTolerance(TPA, 4213586, 6, 482, 60, 497, 11);
  577. end;
  578. 'OnMageTab':
  579. begin
  580. SetColorSpeed2Modifiers(0.06, 0.24);
  581. FindColorsTolerance(TPA, 1382991, 730, 170, 754, 195, 11)
  582. end;
  583. 'Meleer':
  584. begin
  585. SetColorSpeed2Modifiers(0.51, 1.43);
  586. FindColorsTolerance(TPA, 3152966, MSX1, MSY1, MSX2, MSY2, 5)
  587. end;
  588. 'AtSafeSpot':
  589. begin
  590. SetColorSpeed2Modifiers(16.12, 9.26);
  591. FindColorsTolerance(TPA, 15856360, MMX1, MMY1, MMX2, MMY2, 3);
  592. if (Length(TPA) > 0) then
  593. begin
  594. FilterPointsPie(TPA, 0, 360, 10, 30, MMCX, MMCY);
  595. I := TPA;
  596. if Length(I) > 0 then
  597. result := true;
  598. end;
  599. end;
  600. 'FindBankSymbol1':
  601. begin
  602. SetColorSpeed2Modifiers(BankIconHue, BankIconSat);
  603. FindColorsTolerance(TPA, BankIconColor, MMX1, MMY1, MMX2, MMY2, BankIconTol);
  604. end;
  605. end;
  606. ColorToleranceSpeed(CTS);
  607. SetColorSpeed2Modifiers(0.02, 0.2);
  608. if (length(tpa) > 0) and (not (What = 'AtSafeSpot')) then
  609. begin
  610. result := true;
  611. end
  612. else
  613. begin
  614. if (What = 'AtSafeSpot') then
  615. begin
  616. if Length(I) > 0 then
  617. result := true;
  618. end;
  619. end;
  620. end;
  621.  
  622.  
  623.  
  624.  
  625.  
  626. {same as above, except it does radial walking}
  627.  
  628. function DoAction(what: string): boolean;
  629. var
  630. CTS: Integer;
  631. begin
  632. cts := GetColorToleranceSpeed;
  633. ColorToleranceSpeed(2);
  634. case What of
  635. 'WalkToEdgeSouth':
  636. begin
  637. SetColorSpeed2Modifiers(0.00, 0.88);
  638. result := RadialWalkTolerance(1776415, 100, 105, 70, 2, 2, 5);
  639. end;
  640. 'WalkToEdgeSouth2':
  641. begin
  642. SetColorSpeed2Modifiers(0.00, 0.88);
  643. result := RadialWalkTolerance(1776415, 75, 110, 75, 2, 2, 5);
  644. end;
  645. 'WalktoWall':
  646. begin
  647. SetColorSpeed2Modifiers(16.12, 9.26);
  648. result := RadialWalkTolerance(15856360, 324, 356, 75, 2, 2, 3);
  649. end;
  650. 'WalktoWall2':
  651. begin
  652. SetColorSpeed2Modifiers(16.12, 9.26);
  653. result := RadialWalkTolerance(15856360, 290, 300, 50, 2, 2, 3);
  654. end;
  655. 'WalktoWall3':
  656. begin
  657. SetColorSpeed2Modifiers(16.12, 9.26);
  658. result := RadialWalkTolerance(15856360, 225, 270, 50, 2, 2, 3);
  659. end;
  660. end;
  661. ColorToleranceSpeed(CTS);
  662. SetColorSpeed2Modifiers(0.02, 0.2);
  663. end;
  664.  
  665. {example for all the above
  666. Begin
  667. setupsrl;
  668. SetupReflection;
  669. SetupExampleRecord;
  670. if ColorLocateTest(Tcolors1.Color,TColors1.Tol,TColors1.Hmod,TColors1.smod) then
  671. writeln('Hello SRL!');
  672. if ColorLocate('SkillSCreen') then
  673. writeln('yes');
  674. if ColorLocateTest(Tcolors1.Color,TColors1.Tol,TColors1.Hmod,TColors1.smod) then
  675. writeln('Hello SRL!');
  676. end.}
  677.  
  678.  
  679. procedure closerangescreen;
  680. begin
  681. if (not (loggedin)) then
  682. exit; // Closes Range enchant Menu if it gets open.
  683. if (SkillFailsafe = true) then
  684. begin
  685. writeln('we are on skill screen, closing');
  686. mousebox(482, 36, 492, 45, 1);
  687. end;
  688. end;
  689.  
  690.  
  691.  
  692.  
  693. procedure CloseSkillScreen;
  694. begin
  695. if (not (loggedin)) then // closes skill screen if it gets opened.
  696. exit;
  697. if (SkillFailsafe = true) then
  698. begin
  699. writeln('we are on skill screen, closing');
  700. mousebox(494, 17, 500, 22, 1);
  701. end;
  702. end;
  703.  
  704. function GetHpBarAbove: boolean;
  705. var
  706. Hpbar: tpointarray; //Detecs Out HP bar in a small area
  707. begin // This is before MiniMap orbs/reflection were added to the game, obviously i've made much better functionalities for combat detection
  708. result := (FindColorsTolerance(HpBar, 65280, 185, 50, 400, 250, 3)) and (FindColorsTolerance(HpBar, 255, 185, 50, 400, 250, 3))
  709. end; // With that said, this is simple and it works quite well.
  710.  
  711. procedure MouseSpeedz;
  712. begin // Alternates our mouse speed!.
  713. if (not (loggedin)) then
  714. exit;
  715. case random(600) of
  716. 1..450: MouseSpeed := MainMouseSpeed;
  717. 451..570: MouseSpeed := MainMouseSpeed + randomrange( - 1, 1);
  718. 571..590: MouseSpeed := MainMouseSpeed + randomrange( - 1, 2);
  719. 591..600: MouseSpeed := MainMouseSpeed + randomrange( - 1, 3);
  720. end;
  721. end;
  722.  
  723. {Random wait times}
  724. procedure WaitAfterCast;
  725. begin
  726. if (not (loggedin)) then
  727. exit;
  728. case random(600) of
  729. 1..450: Wait(RandomRange(100, 300));
  730. 451..570: Wait(RandomRange(300, 400));
  731. 571..590: Wait(RandomRange(400, 600));
  732. 591..600: Wait(RandomRange(600, 1000));
  733. end;
  734. end;
  735.  
  736. procedure WaitShortClick;
  737. begin
  738. if (not (loggedin)) then
  739. exit;
  740. case random(600) of
  741. 1..450: Wait(RandomRange(100, 150));
  742. 451..570: Wait(RandomRange(150, 200));
  743. 571..590: Wait(RandomRange(200, 250));
  744. 591..600: Wait(RandomRange(250, 400));
  745. end;
  746. end;
  747.  
  748. procedure WaitShortClick2;
  749. begin
  750. if (not (loggedin)) then
  751. exit;
  752. case random(600) of
  753. 1..450: Wait(RandomRange(400, 450));
  754. 451..570: Wait(RandomRange(450, 500));
  755. 571..590: Wait(RandomRange(500, 550));
  756. 591..600: Wait(RandomRange(550, 600));
  757. end;
  758. end;
  759.  
  760. procedure WaitHumanClick;
  761. begin
  762. if (not (loggedin)) then
  763. exit;
  764. case random(600) of
  765. 1..450: Wait(RandomRange(600, 650));
  766. 451..570: Wait(RandomRange(650, 700));
  767. 571..590: Wait(RandomRange(700, 750));
  768. 591..600: Wait(RandomRange(750, 800));
  769. end;
  770. end;
  771.  
  772. procedure WaitHumanClick2;
  773. begin
  774. if (not (loggedin)) then
  775. exit;
  776. case random(600) of
  777. 1..450: Wait(RandomRange(800, 1000));
  778. 451..570: Wait(RandomRange(1000, 1200));
  779. 571..590: Wait(RandomRange(1200, 1400));
  780. 591..600: Wait(RandomRange(1400, 2000));
  781. end;
  782. end;
  783.  
  784. procedure WaitHumanClick3;
  785. begin
  786. if (not (loggedin)) then
  787. exit;
  788. case random(600) of
  789. 1..450: Wait(RandomRange(3000, 5000));
  790. 451..570: Wait(RandomRange(5000, 5500));
  791. 571..590: Wait(RandomRange(6000, 6500));
  792. 591..600: Wait(RandomRange(7000, 7500));
  793. end;
  794. end;
  795.  
  796. procedure WaitHumanClick4;
  797. begin
  798. if (not (loggedin)) then
  799. exit;
  800. case random(600) of
  801. 1..450: Wait(RandomRange(7500, 11000));
  802. 451..570: Wait(RandomRange(11000, 12000));
  803. 571..590: Wait(RandomRange(13000, 14000));
  804. 591..600: Wait(RandomRange(15000, 16000));
  805. end;
  806. end;
  807.  
  808. procedure WaitHumanClick5;
  809. begin
  810. if (not (loggedin)) then
  811. exit;
  812. case random(600) of
  813. 1..450: Wait(RandomRange(61000, 65000));
  814. 451..570: Wait(RandomRange(65000, 70000));
  815. 571..590: Wait(RandomRange(70000, 75000));
  816. 591..600: Wait(RandomRange(75000, 80000));
  817. end;
  818. end;
  819.  
  820.  
  821.  
  822. procedure MakeMyChatTabAll;
  823. begin
  824. if (not (loggedin)) then // if our chat tab isn't on all, it assigns it
  825. exit;
  826. writeln('Our chat Tab is not set to all, making chat tab to all');
  827. mousebox(12, 485, 45, 497, 1);
  828. end;
  829.  
  830. procedure ProgressReport;
  831. var
  832. Timeleft, XpPerhour, Casts, CastsPH: Integer;
  833. begin
  834. if (not (loggedin)) then
  835. exit;
  836. ClearDebug;
  837. XpPerhour := (3600 * (Cast) / ((GetTimeRunning / 1000)));
  838. Casts := ((Cast) / (29));
  839. CastsPH := (3600 * (Casts) / ((GetTimeRunning / 1000)));
  840. timeleft := ((Timer) - (GetTimeRunning));
  841. TimeTillBreak := (MsToTime(timeleft, Time_Formal)); // Prints our progress report.
  842. WriteLn('* FCurser v' + version);
  843. WriteLn('* Runtime: ' + TimeRunning);
  844. Writeln('*');
  845. writeln('* Experience Gained: ' + IntToStr(Cast) + ' Exp P/H: ' + IntToStr(XpPerhour));
  846. writeln('* Curse Used : ' + IntToStr(Casts) + ' Casts P/h: ' + IntTostr(CastsPH));
  847. Writeln('* No. Of Times : ' + 'Failed Casting: ' + intTostr(failcast) + ' Messed up: ' + inttostr(messedup) + ' Entered Cave: ' + IntToStr(CaveEntrances));
  848. if (Breakhandler = true) then
  849. Writeln('* Time till break : ' + (TimeTillBreak));
  850. Writeln('* Post all Bugs/proggies/errors on this topic: http://villavu.com/forum/showthread.php?t=103236');
  851. end;
  852.  
  853. procedure SmartProggy;
  854. var
  855. info1, info2, info3: string;
  856. casts: integer;
  857. begin
  858. if (not (loggedin)) then
  859. exit;
  860. if (DoSmartProgress = true) then
  861. exit; // debugs progress report on smart screen
  862. Casts := ((Cast) / (29));
  863. info1 := 'FCurser V' + version;
  864. info2 := 'Runtime: ' + TimeRunning;
  865. info3 := 'Casts Used: ' + IntToStr(Casts);
  866. SMART_ClearCanvas;
  867. SMART_DrawText(350, 0, CharsNPC, info1, clWhite);
  868. SMART_DrawText(350, 15, CharsNPC, info2, clWhite);
  869. SMART_DrawText(350, 30, CharsNPC, info3, clWhite);
  870. end;
  871.  
  872.  
  873. {Credits to SRL-oSR Dev team, i simply added CTS with Hue/Sat to color finding with this object finder, its better suited for cursing tzhaar monsters}
  874. function FindObjExX(var cx, cy: Integer; Text: TStringArray; Color: TIntegerArray; Tol, CTS: integer; Hue, Sat: Extended; Step, xs, ys, xe, ye: Integer): Boolean;
  875. var
  876. MidX, MidY, i, j, k, x, y, width, height, HalfWidth, HalfHeight: Integer;
  877. ColorFound: Boolean;
  878. SearchBoxes: array of array of TBox;
  879. p: TPointArray;
  880. begin
  881. if (not (loggedin)) then
  882. exit;
  883. Result := False;
  884. for i := 0 to (GetArrayLength(Color) - 1) do
  885. begin
  886. ColorToleranceSpeed(CTS);
  887. SetColorSpeed2Modifiers(Hue, sat);
  888. if (FindColorSpiralTolerance(cx, cy, Color[i], xs, ys, xe, ye, Tol)) then
  889. begin
  890. ColorToleranceSpeed(0);
  891. SetColorSpeed2Modifiers(0.2, 0.2);
  892. ColorFound := True;
  893. Break;
  894. end;
  895. end;
  896. if not (ColorFound) then
  897. Exit;
  898. MidX := Round((xe - xs) / 2);
  899. MidY := Round((ye - ys) / 2);
  900. Width := Ceil(abs(xe - xs) / 2 / Step - 0.5) * 2 + 1;
  901. Height := Ceil(abs(ye - ys) / 2 / Step - 0.5) * 2 + 1;
  902. SetLength(SearchBoxes, Width);
  903. HalfWidth := Floor(Width / 2);
  904. HalfHeight := Floor(Height / 2) for x := - 1 * HalfWidth to HalfWidth do
  905. begin
  906. SetLength(SearchBoxes[x + HalfWidth], Height);
  907. for y := - 1 * HalfHeight to HalfHeight do
  908. SearchBoxes[x + HalfWidth][y + HalfHeight] := IntToBox(Max(xs, xs + Round(MidX + ((x - 0.5) * Step))), Max(ys, ys + Round(MidY + ((y - 0.5) * Step))), Min(xe, xs + Round(MidX + ((x + 0.5) * Step))), Min(ye, ys + Round(MidY + ((y + 0.5) * Step))));
  909. end;
  910. p := TPAFromBox(IntToBox(0, 0, Width - 1, Height - 1));
  911. SortTPAFrom(p, Point(floor(Width / 2), floor(Height / 2)));
  912. for k := 0 to High(Color) do
  913. for j := 0 to High(p) do
  914. begin
  915. ColorToleranceSpeed(CTS); // what i added.
  916. SetColorSpeed2Modifiers(Hue, sat);
  917. if (FindColorTolerance(cx, cy, Color[k], SearchBoxes[p[j].x][p[j].y].x1, SearchBoxes[p[j].x][p[j].y].y1, SearchBoxes[p[j].x][p[j].y].x2, SearchBoxes[p[j].x][p[j].y].y2, Tol)) then
  918. begin
  919. case random(25) of
  920. 0..15: MMouse(cx, cy, randomrange( - 3, 3), randomrange( - 3, 3));
  921. 16..17: MMouse(cx, cy, randomrange( - 5, 5), randomrange( - 5, 5));
  922. 18..19: MMouse(cx, cy, randomrange( - 6, 6), randomrange( - 6, 6));
  923. 20..21: MMouse(cx, cy, randomrange( - 7, 7), randomrange( - 7, 7)); // added to the mix
  924. 22..23: MMouse(cx, cy, randomrange( - 8, 8), randomrange( - 8, 8));
  925. 24..25: MMouse(cx, cy, randomrange( - 9, 9), randomrange( - 9, 9));
  926. end;
  927. if (WaitUptextMulti2(Text, 300)) then
  928. begin
  929. ColorToleranceSpeed(1);
  930. SetColorSpeed2Modifiers(0.2, 0.2);
  931. GetMousePos(cx, cy);
  932. Result := True;
  933. Exit;
  934. end;
  935. end;
  936. ColorToleranceSpeed(1);
  937. SetColorSpeed2Modifiers(0.2, 0.2);
  938. end;
  939. ColorToleranceSpeed(1);
  940. SetColorSpeed2Modifiers(0.2, 0.2);
  941. end;
  942.  
  943.  
  944. {Bank icon detection}
  945. function FindManualBankMM: boolean;
  946. var
  947. x, y: integer;
  948. begin // This is done by the player, using a guide i link to in the setup.
  949. result := FindObjExX(x,y,[''],[BankMMColor1],BankMMTolerance,1,0.2,0.2,50,MMX1, MMY1, MMX2, MMY2);
  950. end;
  951.  
  952. function FindBankBMP: Boolean;
  953. var
  954. Bank: integer; //This is a bitmap i made a while ago, still works.
  955. x, y: integer;
  956. begin
  957. Bank := BitmapFromString(3, 5, 'meJxzOvOcMb4YgpxgbDQGnAsAnfwS' + 'CA==');
  958. SetBitmapName(Bank, 'FindBanksymbolFunction');
  959. result := (FindBitMapToleranceIn(Bank, X, Y, MMX1, MMY1, MMX2, MMY2, 65)) FreeBitmap(Bank);
  960. end;
  961.  
  962. function AutoBankSymbols2: boolean;
  963. var // This uses the SRL-OSR bitmap which i found very laggy on my old laptop
  964. x, y: integer; // Well, let's just say this new laptop i got can run 6 runescape clients without even using 10% cpu..
  965. begin // so i like it now :).
  966. result := (FindSymbol(x, y, 'bank') or FindSymbol(x, y, 'minigame'));
  967. end;
  968.  
  969. function FindBankSymbol1: Boolean;
  970. var
  971. TPA: tpointarray;
  972. begin
  973. if (not (loggedin)) then
  974. exit; //This is a color i made by hoping worlds and using AutoColorAid
  975. ColorToleranceSpeed(2); // It took a while to get but should work (*EXCEPT*) when you load rs and its really bright.
  976. SetColorSpeed2Modifiers(BankIconHue, BankIconSat); // Then it mistakes NPC'S for bank symbol.. Lol.
  977. result := FindColorsTolerance(TPA, BankIconColor, MMX1, MMY1, MMX2, MMY2, BankIconTol);
  978. ColorToleranceSpeed(0);
  979. SetColorSpeed2Modifiers(0.2, 0.2);
  980. end;
  981.  
  982.  
  983.  
  984. function FindBanksymbol: BOolean;
  985. begin
  986. if (ManualBankMM = true) then
  987. begin
  988. result := (FindManualBankMM) or (findbankBMP);
  989. end
  990. else
  991. begin
  992. if (AutoBankMM = true) then
  993. begin
  994. result := (FindBanksymbol1); // A basic function that decides how to locate Bank Symbol - it all depends on what the user
  995. end // Decides to use, be it my own personal bitmap/bank colors or his own or the include's bitmap.
  996. else
  997. begin
  998. if (Autobankmm2 = true) then
  999. begin
  1000. result := (AutoBankSymbols2);
  1001. end;
  1002. end;
  1003. end;
  1004. end;
  1005.  
  1006. function OnlobbyScreen: boolean;
  1007. begin
  1008. result := (GetColor(381, 336) = 16777215); // This has never worked.
  1009. end;
  1010.  
  1011. procedure ClickToEnterLobby;
  1012. begin
  1013. if (not (loggedin)) then // Doesnt work since the Login procedure stops everything else.
  1014. exit;
  1015. if Findbanksymbol then
  1016. exit;
  1017. MouseBox(323, 312, 450, 350, mouse_right);
  1018. waithumanclick;
  1019. ChooseOption('lay');
  1020. end;
  1021.  
  1022. function HoverNearbyNpc: boolean;
  1023. var
  1024. I: Tpointarray;
  1025. P: Integer;
  1026. begin // This is a Basic antiban that Moves mouse to near by yellow NPC dots.
  1027. if (not (loggedin)) then
  1028. exit;
  1029. I := GetMiniMapDots('npc'); // gets the dots.
  1030. if (length(I) > 0) then // If there are dots then continues..
  1031. begin
  1032. SortTPAFrom(i, Point(MMCX, MMCY)); // sorts them from center point.
  1033. P := random(length(I)) Mmouse(I[0].x, I[0].y, 3, 3); // moves to a random npc dot.
  1034. result := true; // and this should be a procedure not function
  1035. end;
  1036. end; // last time i changed it i had a black out and forgot what i was doing, so am a leave it at that.
  1037.  
  1038. procedure Keyboards;
  1039. begin
  1040. case random(5) of
  1041. 0..2:
  1042. begin
  1043. KeyDown(37);
  1044. WaitShortClick KeyUp(37);
  1045. WaitShortClick KeyDown(40);
  1046. WaitShortClick KeyUp(40);
  1047. end;
  1048. 3..4: // moves keyboards.
  1049. begin
  1050. KeyDown(39);
  1051. WaitShortClick KeyUp(39);
  1052. WaitShortClick KeyDown(38);
  1053. WaitShortClick KeyUp(38);
  1054. end;
  1055. 5:
  1056. begin
  1057. KeyDown(38);
  1058. WaitShortClick KeyUp(38);
  1059. WaitShortClick KeyDown(39);
  1060. WaitShortClick KeyUp(39);
  1061. end;
  1062. end;
  1063. end;
  1064.  
  1065. procedure Antiban;
  1066. begin
  1067. if (not (loggedin)) then // Our antiban,
  1068. exit;
  1069. case random(100) of
  1070. 0..56:
  1071. begin
  1072. end;
  1073. 57..100:
  1074. begin
  1075. case random(150) of
  1076. 10: hoverskill(skill_magic, false);
  1077. 20: BoredHuman;
  1078. 30: MMouseOffClient('top');
  1079. 40: MMouseOffClient('left');
  1080. 50: MMouseOffClient('right');
  1081. 60: MMouseOffClient('bottom');
  1082. 70: SmallRandomMouse;
  1083. 80: RandomAngle(1);
  1084. 90: RandomAngle(2);
  1085. 100: PickUpMouse;
  1086. 110: CompassMovement(10, 70, true);
  1087. 120: HoverNearbyNpc; // Thats the procedure above
  1088. 130: Keyboards; // Same as above
  1089. 140: MissMouse(250, 250);
  1090. 150: RandomMovement; // Rest are from the include.
  1091. 160: CompassMovement(240, 300, true);
  1092. 170: AdjustMouseSpeed(3, 10, 20);
  1093. 180: RandomFKeys(true);
  1094. 190: RandomTab(true);
  1095. end;
  1096. end;
  1097. end;
  1098. end;
  1099.  
  1100.  
  1101.  
  1102. function AlreadyWeakend: boolean; // Finds the word 'foe' in text to know if the NPC is weaked and then warn the player.
  1103. begin
  1104. if (not (loggedin)) then
  1105. exit;
  1106. result := FindTextTPA(clBlack, 0, MCX1, MCY1, MCX2, MCY2, 'foe', smallChars07, Nothing);
  1107. end;
  1108.  
  1109. procedure NPCisWeakend;
  1110. begin
  1111. if (not (loggedin)) then
  1112. exit;
  1113. writeln('our Foe is already weakend, We could wait one minute, but were going to log out and log in, its much faster, make sure you have -65 MAGE! if you dont, then your spell WILL HIT!');
  1114. if LogMeOut then
  1115. writeln('we have logged out')
  1116. else termination('Our NPC got weakened and we failed to log out.. ending script!');
  1117. end;
  1118.  
  1119. function OutofRunes: boolean;
  1120. begin
  1121. if (not (loggedin)) then
  1122. exit; // Detects the word in chat box that tells the user that his avatar is out of runes usually the word 'body' 'ody'.
  1123. result := FindTextTPA(clBlack, 0, MCX1, MCY1, MCX2, MCY2, TheMagicWord, smallChars07, Nothing);
  1124. end;
  1125.  
  1126.  
  1127.  
  1128. procedure FindIfonMagetab;
  1129. begin
  1130. if (not (loggedin)) then
  1131. exit;
  1132. if not ColorLocate('OnmageTab') then
  1133. begin
  1134. gametab(tab_magic);
  1135. waitshortclick2; // Gametab(tab magic) works.. But i want more fail safes.
  1136. end
  1137. else
  1138. begin
  1139. if ColorLocate('OnmageTab') then
  1140. exit;
  1141. end;
  1142. end;
  1143.  
  1144.  
  1145.  
  1146. {This is used to detect the white cave entrance, but the difference between this one and others *Other than the fact it can lead to out of range errors* it wont move mouse to any other object/player in white on the screen}
  1147. function FindObjectFar(Color: TintegerArray; Tol, CTS: integer; hMoD, sMoD: extended; Uptext: array of string; WaitUptextWait, WaitUptextRandom: Integer; x, y, xs, ys: integer): boolean;
  1148. var
  1149. III, i, tmpcts: integer;
  1150. TPA: tpointarray;
  1151. TPAA: T2DPointArray;
  1152. begin
  1153. if (not (loggedin)) then
  1154. exit;
  1155. tmpcts := GetColorToleranceSpeed;
  1156. ColorToleranceSpeed(CTS); // grabs our colors for the cave.
  1157. SetColorSpeed2Modifiers(hMoD, SMoD);
  1158. FindColorsSpiralTolerance(MSCX, MSCY, TPA, color[III], x, y, xs, ys, Tol)
  1159. ColorToleranceSpeed(tmpCTS);
  1160. SetColorSpeed2Modifiers(0.2, 0.2);
  1161. SplitTPAWrap(TPA, 10, TPAA);
  1162. SortATPAFromSize(TPAA, 10, false);
  1163. case Entrancemode of
  1164. 1:
  1165. begin // I've asked and asked how can you do case to the 64xInteger bits (I.E Low/High) so you won't have to write case or two functions.. But nope, not possible.
  1166. for I := 0 to low(TPAA) do // This inverts the object finding, it goes straight for the cave but sometimes crashes! so i dont recommend it.
  1167. begin // Only reason i made this was because one person wanted it to fully click the cave
  1168. MiddleTPAEx(TPAA[i], X, Y); // and since we didn't have reflection.. yet I came up with this easy solution.
  1169. MMouse(x, y, RandomRange( - 50, 50), RandomRange( - 25, 25));
  1170. if WaitUpTextMulti2(uptext, WaitUptextWait + random(WaitUptextRandom)) then
  1171. begin
  1172. Result := True;
  1173. GetMousePos(X, Y);
  1174. break; // If only it was possible to do the Low/High in Case by them selves in one line, it would save up 10 lines.
  1175. end;
  1176. break;
  1177. end;
  1178. end;
  1179. 3:
  1180. for I := 0 to High(TPAA) do // This is fine.
  1181. begin
  1182. MiddleTPAEx(TPAA[i], X, Y);
  1183. MMouse(x, y, RandomRange( - 50, 50), RandomRange( - 25, 25));
  1184. if WaitUpTextMulti2(uptext, WaitUptextWait + random(WaitUptextRandom)) then
  1185. begin
  1186. Result := True;
  1187. GetMousePos(X, Y);
  1188. break;
  1189. end; // Incase you're wondering Mode 2 is that plain Findobjexx function!.
  1190. break;
  1191. end;
  1192. end;
  1193. end;
  1194.  
  1195.  
  1196.  
  1197.  
  1198.  
  1199. {This finds our monster and does the magic!@}
  1200. function LocateMonster1(Color: TintegerArray; Tol, CTS: integer; hMoD, sMoD: Extended; Uptext: array of string): Boolean;
  1201. var
  1202. R, ii, X, y, i, tmpcts: integer;
  1203. TPA: Tpointarray;
  1204. ATPA: T2DPointArray;
  1205. Boxm: tbox;
  1206. begin
  1207. if (not (Loggedin)) then
  1208. exit;
  1209. if not ColorLocate('Meleer') then
  1210. exit;
  1211. if (findbanksymbol) then
  1212. exit;
  1213. if (AttempSolvingRandoms = true) and findtalk2 then // Like i've said before, find talk 2 wont switch to inv tab but will find the player's nickname in yellow text!.
  1214. findnormalrandoms; // If it does.. Then it switches to normalrandoms!.
  1215. case random(10) of
  1216. 0..3: MouseSpeedz; // changes mouse speed..
  1217. 4..10: writeln('not changing mouse speed');
  1218. end;
  1219. FindIfonMagetab; // find if we did switch to mage tab.
  1220. case random(10) of
  1221. 0..7: Mouse(RandomRange(668, 669), RandomRange(263, 264), random(3), random(3), mouse_move);
  1222. 8..10: Mouse(RandomRange(663, 670), RandomRange(260, 265), random(1), random(1), mouse_move); // then click curse.
  1223. end;
  1224. if WaitUpTextMulti2(['Curse'], 300) then // the word 'Curse' is green!....
  1225. begin
  1226. clickmouse2(mouse_left);
  1227. waitshortclick;
  1228. tmpCTS := GetColorToleranceSpeed;
  1229. ColorToleranceSpeed(CTS);
  1230. SetColorSpeed2Modifiers(hMoD, sMoD);
  1231. FindColorsTolerance(TPA, Color[ii], MSX1, MSY1, MSX2, MSY2, Tol);
  1232. ColorToleranceSpeed(tmpCTS);
  1233. setColorSpeed2Modifiers(0.2, 0.2); //This is the level 45 color. Just an extra fail safe.
  1234. if Length(TPA) < 0 then
  1235. exit;
  1236. if (Length(TPA) > 0) and (Length(TPA) < 100) then // if the monster is not in a good camera angle..
  1237. setangle(1);
  1238. case random(10) of
  1239. 0..7:
  1240. begin
  1241. end;
  1242. 8..10: // then script will change camera.
  1243. begin
  1244. R := Random(GetArrayLength(ATPA));
  1245. DeleteValueInTPA(TPA, R);
  1246. end;
  1247. end;
  1248. SplitTPAWrap(TPA, 10, ATPA);
  1249. Boxm := GetATPABounds(ATPA); // creates bounds for the monst
  1250. case random(500) of
  1251. 0..480: SortATPASize(ATpA, true); // Either sorts it from Size or
  1252. 481..499: SortATPAFromFirstPoint(ATPA, IntToPoint(MSCX, MSCY)); // From first point.
  1253. end;
  1254. for I := 0 to HIGH(ATPA) do // ALl the above is used to alternate where the mouse will head to!
  1255. begin // obviously it will click one spot more than others.. That's what a human would do, but then again slip a few times and not click the same spot or miss click.
  1256. case random(10) of
  1257. 0..1: MouseSpeedz; // changes mouse speed..
  1258. 2..10: writeln('not changing mouse speed');
  1259. end;
  1260. MiddleTPAEx(ATPA[i], X, Y); // gets center point!
  1261. begin
  1262. case random(25) of
  1263. 0..15: MMouse(x, y, randomrange( - 3, 3), randomrange( - 3, 3));
  1264. 16..17: MMouse(x, y, randomrange( - 5, 5), randomrange( - 5, 5));
  1265. 18..19: MMouse(x, y, randomrange( - 6, 6), randomrange( - 6, 6)); // SO moves mouse with offset.
  1266. 20..21: MMouse(x, y, randomrange( - 7, 7), randomrange( - 7, 7));
  1267. 22..23: MMouse(x, y, randomrange( - 8, 8), randomrange( - 8, 8));
  1268. 24..25: MMouse(x, y, randomrange( - 9, 9), randomrange( - 9, 9));
  1269. end;
  1270. if WaitUpTextMulti2(['Curse'], 300) then
  1271. begin
  1272. wait(randomrange(90, 120));
  1273. clickmouse2(mouse_left); // and there it goes..
  1274. if Didclick(true, 1000) then
  1275. begin
  1276. IncEx(cast, 29);
  1277. if (dosmartprogress = true) then
  1278. SmartProggy;
  1279. progressreport;
  1280. case playermode of
  1281. 1:
  1282. begin
  1283. case random(100) of
  1284. 0..80:
  1285. begin
  1286. end;
  1287. 81..100: Antiban;
  1288. end;
  1289. case random(50) of
  1290. 0..42: waitafterCast;
  1291. 43..48: waithumanclick2;
  1292. end;
  1293. end;
  1294. 2:
  1295. begin
  1296. end;
  1297. end;
  1298. result := true;
  1299. exit;
  1300. end
  1301. else
  1302. begin
  1303. inc(Failcast);
  1304. exit;
  1305. end;
  1306. end
  1307. else
  1308. begin
  1309. inc(failcast);
  1310. exit;
  1311. end;
  1312. break;
  1313. end;
  1314. break;
  1315. end;
  1316. end;
  1317. end;
  1318.  
  1319. procedure LocateMonster2;
  1320. var
  1321. Cx, Cy, tmpcts: integer;
  1322. TPA: Tpointarray;
  1323. begin
  1324. if (not (Loggedin)) then // Same as above except its designed for pure bot mode, no wait times.
  1325. exit;
  1326. if not ColorLocate('Meleer') then
  1327. exit;
  1328. if (findbanksymbol) then
  1329. exit;
  1330. if (AttempSolvingRandoms = true) and findtalk2 then
  1331. findnormalrandoms;
  1332. MouseSpeedz;
  1333. FindIfonMagetab;
  1334. case random(10) of
  1335. 0..7: Mouse(RandomRange(668, 669), RandomRange(263, 264), random(3), random(3), mouse_move);
  1336. 8..10: Mouse(RandomRange(663, 670), RandomRange(260, 265), random(1), random(1), mouse_move);
  1337. end;
  1338. if WaitUpTextMulti2(['Curse'], 300) then
  1339. begin
  1340. clickmouse2(mouse_left);
  1341. waitshortclick;
  1342. tmpCTS := GetColorToleranceSpeed;
  1343. ColorToleranceSpeed(2);
  1344. SetColorSpeed2Modifiers(0.51, 1.43);
  1345. FindColorsTolerance(TPA, 3152966, MSX1, MSY1, MSX2, MSY2, 5);
  1346. ColorToleranceSpeed(tmpCTS);
  1347. setColorSpeed2Modifiers(0.2, 0.2);
  1348. if Length(TPA) < 0 then
  1349. exit;
  1350. if (Length(TPA) > 0) and (Length(TPA) < 100) then
  1351. setangle(1);
  1352. mousespeedz;
  1353. FindObjExX(cx, cy, ['Curse'], [3152966], 5, 2, 0.51, 1.43, 50, MSX1, MSY1, MSX2, MSY2);
  1354. if WaitUpTextMulti2(['Curse'], 300) then
  1355. begin
  1356. wait(randomrange(90, 120));
  1357. clickmouse2(mouse_left);
  1358. if Didclick(true, 1000) then
  1359. begin
  1360. IncEx(cast, 29);
  1361. if (dosmartprogress = true) then
  1362. SmartProggy;
  1363. progressreport;
  1364. case playermode of
  1365. 1:
  1366. begin
  1367. case random(100) of
  1368. 0..80:
  1369. begin
  1370. end;
  1371. 81..100: Antiban;
  1372. end;
  1373. case random(50) of
  1374. 0..42: waitafterCast;
  1375. 43..48: waithumanclick2;
  1376. end;
  1377. end;
  1378. 2:
  1379. begin
  1380. end;
  1381. end;
  1382. end
  1383. else
  1384. begin
  1385. inc(Failcast);
  1386. exit;
  1387. end;
  1388. end
  1389. else
  1390. begin
  1391. inc(failcast);
  1392. end;
  1393. end;
  1394. end;
  1395.  
  1396. procedure locatemonster;
  1397. begin
  1398. case Mattmode of
  1399. 1: LocateMonster1([3152966], 5, 2, 0.51, 1.43, ['Curse']);
  1400. 2: Locatemonster2; // depends on player choice.
  1401. end;
  1402. end;
  1403.  
  1404. function safe: boolean;
  1405. var
  1406. x, y: integer; // This uses SeanStar's cave entrance color, they work well.
  1407. begin
  1408. result := FindObjCustom(x, y, ['nter'], caveEntranceWhite, 2);
  1409. end;
  1410.  
  1411. procedure CheckifInDanger;
  1412. var
  1413. x, y, t: integer;
  1414. begin
  1415. if (not (loggedin)) then // Checks if we are in combat outside cave.
  1416. exit;
  1417. if (OutFailSafe = false) then
  1418. exit;
  1419. if (AttempSolvingRandoms = true) then
  1420. findnormalrandoms;
  1421. if (gethpbarabove) and (findbanksymbol) then
  1422. begin
  1423. if (AttempSolvingRandoms = true) then
  1424. findnormalrandoms;
  1425. marktime(t); // Sets a timer.
  1426. while (TimeFromMark(T) < HpBarOutside) do // Waits during that timer and tries to enter cave
  1427. begin
  1428. wait(400);
  1429. if (not (loggedin)) then
  1430. exit;
  1431. if FindObjCustom(x, y, ['nter'], caveEntranceWhite, 2) then
  1432. clickmouse2(mouse_left);
  1433. if (AttempSolvingRandoms = true) then
  1434. findnormalrandoms;
  1435. if (not (findbanksymbol)) then
  1436. exit;
  1437. if (not (getHpbarabove)) then
  1438. exit; // if we fail to enter then.. It Continues and ends script.
  1439. if (TimeFromMark(T) >= HpBarOutside) then
  1440. begin
  1441. if (not (findbanksymbol)) then
  1442. exit;
  1443. if (not (getHpbarabove)) then
  1444. exit;
  1445. if findbanksymbol and GetHpbarAbove then
  1446. begin
  1447. if (AttempSolvingRandoms = true) then
  1448. findnormalrandoms;
  1449. if (GetSkillInfo(3, false) < LowHpOutside) then
  1450. begin
  1451. if (AttempSolvingRandoms = true) then
  1452. findnormalrandoms;
  1453. gametab(tab_magic);
  1454. waithumanclick;
  1455. mouse(665, 286, 0, 0, mouse_left); // script will try to tele out.
  1456. waithumanclick2;
  1457. if LogMeOut then // if managed to log out then..
  1458. Termination('We got stuck in combat outside cave, terminating, managed to log out.')
  1459. else // if not then..
  1460. Termination('Stuck outside cave in combat, couldnt log out terminating');
  1461. end;
  1462. end;
  1463. end;
  1464. end;
  1465. end;
  1466. end;
  1467.  
  1468.  
  1469. function CavesTime: boolean;
  1470. begin // detects the cave wait time message upon entrance.
  1471. if (not (loggedin)) then
  1472. exit;
  1473. result := FindTextTPA(ClBlack, 30, MCX1, MCY1, MCX2, MCY2, 'gain', CharsNPC07, Nothing);
  1474. end;
  1475.  
  1476. procedure HandleCaveTime;
  1477. begin
  1478. if CavesTime then
  1479. begin
  1480. writeln('we have to wait before we can re-enter, logging out and waiting two minutes');
  1481. if LogMeOut then
  1482. begin
  1483. writeln('Waiting for cave time to pass');
  1484. wait(randomrange(125000, 135000));
  1485. exit;
  1486. end;
  1487. end;
  1488. end;
  1489.  
  1490. procedure EnterCave;
  1491. var
  1492. x, y: integer;
  1493. begin
  1494. if (EntranceMode = 1) or (entrancemode = 3) then
  1495. begin
  1496. if FindObjectFar([CaveColor], Cavetol, CaveCTS, CaveHue, CaveSat, ['nter'], 100, 50, MSX1, MSY1, MSX2, MSY2) then
  1497. begin
  1498. ClickMouse2(mouse_left);
  1499. ColorToleranceSpeed(0);
  1500. SetColorSpeed2Modifiers(0.2, 0.2);
  1501. if CavesTime then
  1502. HandleCaveTime;
  1503. waithumanclick3; // enters cave.. entrance mode is chosen by player.
  1504. if CavesTime then
  1505. HandleCaveTime;
  1506. if ClickContinueEx(false, false) then
  1507. begin
  1508. wait(randomrange(11000, 15000));
  1509. if (UseReflection = true) then
  1510. MyPosition := R_GetTileGlobal;
  1511. clicktocontinue;
  1512. end;
  1513. end;
  1514. end
  1515. else
  1516. begin
  1517. if EntranceMode = 2 then
  1518. begin
  1519. if FindObjCustom(x, y, ['nter'], caveEntranceWhite, 2) then
  1520. begin
  1521. ColorToleranceSpeed(0);
  1522. SetColorSpeed2Modifiers(0.2, 0.2);
  1523. Clickmouse2(mouse_left);
  1524. waithumanclick2;
  1525. if CavesTime then
  1526. HandleCaveTime;
  1527. if CavesTime then
  1528. HandleCaveTime;
  1529. if ClickContinueEx(false, false) then
  1530. begin
  1531. wait(randomrange(11000, 15000));
  1532. if (UseReflection = true) then
  1533. MyPosition := R_GetTileGlobal;
  1534. clicktocontinue;
  1535. end;
  1536. end;
  1537. end;
  1538. end;
  1539. end;
  1540.  
  1541.  
  1542.  
  1543.  
  1544. procedure EnterCaveLoop;
  1545. begin
  1546. if (not (loggedin)) then
  1547. exit;
  1548. ColorToleranceSpeed(0);
  1549. SetColorSpeed2Modifiers(0.2, 0.2);
  1550. if (AttempSolvingRandoms = true) then
  1551. findnormalrandoms;
  1552. MakeCompass(randomrange(165, 189));
  1553. setangle(0);
  1554. waitMore;
  1555. repeat
  1556. waitMore;
  1557. EnterCave; // And this is our entrance loop
  1558. if CavesTime then
  1559. HandleCaveTime;
  1560. if ColorLocate('Skillscreen') then
  1561. CloseSkillScreen;
  1562. waitMore;
  1563. if (getHpbarabove) then
  1564. exit;
  1565. if (AttempSolvingRandoms = true) then
  1566. findnormalrandoms;
  1567. waitMore;
  1568. if (not (Findbanksymbol)) then
  1569. break; // keeps trying to enter!
  1570. if (not (loggedin)) then
  1571. exit;
  1572. until (not (findbanksymbol)) or (not (loggedin));
  1573. if ClickContinueEx(false, false) then
  1574. begin
  1575. wait(randomrange(11000, 15000));
  1576. if (UseReflection = true) then
  1577. MyPosition := R_GetTileGlobal;
  1578. clicktocontinue;
  1579. end;
  1580. AntiBan;
  1581. if ColorLocate('SkillScreen') then
  1582. CloseSkillScreen;
  1583. if (AttempSolvingRandoms = true) then
  1584. findnormalrandoms;
  1585. MakeCompass('n');
  1586. setangle(0);
  1587. Inc(CaveEntrances);
  1588. exit;
  1589. end;
  1590.  
  1591.  
  1592. function NPCNearBy: boolean;
  1593. var
  1594. TPA: Tpointarray;
  1595. begin // Checks the distance between the Player and NPC
  1596. TPA := GetMiniMapDots('npc');
  1597. if (length(TPA) > 0) then // more explained in the setup const's.
  1598. begin
  1599. SortTPAFrom(TPA, Point(MMCX, MMCY));
  1600. FilterPointsPie(TPA, 5, 360, MinNPCdistance, MaxNPCdistance, MMCX, MMCY);
  1601. if (length(tpa) > 0) then
  1602. begin
  1603. writeln('NPC in range, not going to perform running to midpath');
  1604. result := true;
  1605. end;
  1606. end;
  1607. end;
  1608.  
  1609. procedure RunToTheNPC;
  1610. var
  1611. TPA, TPA2, TPA3, TPA2B: TpointArray;
  1612. I, x, y, CTS: Integer;
  1613. P1, P2: tpoint;
  1614. ATPA: T2DPointArray;
  1615. begin
  1616. if (not (loggedin)) then
  1617. exit;
  1618. if (findbanksymbol) then // creates a path between the player and the NPC, runs midpath towards it (not exactly to it, more like 2 squares north of it.. Thus reaching closest spot and getting most exp}
  1619. exit;
  1620. FindColorsTolerance(TPA, 16777215, MMX1, MMY1, MMX2, MMY2, 7)
  1621. cts := GetColorToleranceSpeed;
  1622. ColorToleranceSpeed(2);
  1623. SetColorSpeed2Modifiers(0.00, 0.12);
  1624. FindColorsTolerance(TPA2, 126702, MMX1, MMY1, MMX2, MMY2, 7)
  1625. ColorToleranceSpeed(CTS);
  1626. SetColorSpeed2Modifiers(0.02, 0.2);
  1627. if (Length(TPA) < 0) and (Length(TPA2) < 0) then
  1628. exit;
  1629. FilterPointsPie(TPA2, 0, 360, MinNPCRadius, MaxNPCRadius, MMCX, MMCY) ceil((Length(TPA2) * 100) / ((Pi * (25 * 25)) * ((360 - 5) / 360.0) - ((Pi * (5 * 5)) * ((360 - 5) / 360.0)))); // The second part i took from Villavu forums - credits goes to owner of the formula (post i took it from said it was copy pasting it from another post, which i cant find for some reason}
  1630. TPA2B := TPA2 if (Length(TPA2B) > 0) then // Believe it or not, the above was the easy part.. The parts below took almost a week to figure out. Only reason i was motivated to finish it is because Dgby said something that i found really offensive when i asked him to help :P, i got back at him - sent him the link for this RAW on pastebin :D.
  1631. begin
  1632. P1 := MiddleTPA(TPA); //Right once that hard part is out of the way, it creates mid path between you and the final point.
  1633. P2 := MiddleTPA(TPA2B);
  1634. TPA3 := TPABetweenPoints(P2, P1, 1, 0); // This TPA between both points.
  1635. ATPA := FindGapsTPA(TPA3, 20); // Finds the gaps between them (Straight path i guess)
  1636. MiddleTPAEx(ATPA[i], X, Y); // Then we create middle path from it
  1637. SortATPAFromSize(ATPA, 1, true); // we sort it
  1638. if (length(ATPA[i]) > 0) then // and if its big enough (keep in mind we use specific radius, everything not in it is unaccounted for
  1639. begin
  1640. writeln('NPC far from our distance, going to run midpath');
  1641. mouse(x, y, 2, 2, mouse_left); // we'll run midpath which is usually 2 squares or so from it, thus we can start maging safely!
  1642. flag;
  1643. end;
  1644. end;
  1645. end;
  1646.  
  1647. procedure WalktoSafeSpot;
  1648. var
  1649. R_RightSide, R_Safespot: tpoint;
  1650. begin
  1651. if (not (loggedin)) then
  1652. exit;
  1653. if (UseReflection = true) and (MyPosition.x > 0) then
  1654. begin
  1655. R_RightSide.x := MyPosition.x + 24;
  1656. R_RightSide.y := MyPosition.y - 5; // Because reflection uses Camera to walk - this most likely won't hit the correct square!
  1657. R_Safespot.x := MyPosition.x + 12;
  1658. R_Safespot.y := MyPosition.y + 5;
  1659. R_WebWalk(R_RightSide);
  1660. wait(randomrange(5000, 7000));
  1661. R_WebWalk(R_Safespot);
  1662. makecompass(randomrange(140, 160));
  1663. SetAngle(1);
  1664. wait(randomrange(5000, 7000));
  1665. if ColorLocate('AtSafeSpot') then
  1666. exit;
  1667. end
  1668. else
  1669. begin
  1670. MakeCompass('n');
  1671. SetAngle(0);
  1672. SetRun(true);
  1673. if ColorLocate('AtSafeSpot') then
  1674. exit;
  1675. if not DoAction('WalkToEdgeSouth') then
  1676. writeln('failed'); //However, radial walk works 9/10 of times!
  1677. fflag(0);
  1678. if not DoAction('WalkToEdgeSouth2') then
  1679. writeln('failed2');
  1680. fflag(0);
  1681. wait(randomrange(3000, 5000));
  1682. if not DoAction('WalktoWall') then
  1683. writeln('yes');
  1684. fflag(0);
  1685. if not DoAction('WalktoWall2') then
  1686. writeln('yes2');
  1687. fflag(0);
  1688. if not DoAction('WalktoWall3') then
  1689. writeln('we are in safe spot or failed');
  1690. fflag(0);
  1691. makecompass(randomrange(140, 160));
  1692. SetAngle(1);
  1693. wait(randomrange(5000, 7000));
  1694. if ColorLocate('AtSafeSpot') then
  1695. exit;
  1696. end;
  1697. end;
  1698.  
  1699. procedure FixMessup;
  1700. begin
  1701. if (AttempSolvingRandoms = true) and findtalk2 then
  1702. findnormalrandoms;
  1703. if (not (loggedin)) then
  1704. exit;
  1705. if (not (getHpbarabove)) then
  1706. exit;
  1707. if (Gethpbarabove) and (ColorLocate('AtSafeSpot')) then
  1708. begin
  1709. if (AttempSolvingRandoms = true) and findtalk2 then
  1710. findnormalrandoms;
  1711. if (not (getHpbarabove)) then
  1712. exit;
  1713. repeat
  1714. wait(400);
  1715. if (AttempSolvingRandoms = true) and findtalk2 then
  1716. findnormalrandoms;
  1717. if (AttempSolvingRandoms = true) and findtalk2 then
  1718. findnormalrandoms;
  1719. logout;
  1720. if (AttempSolvingRandoms = true) and findtalk2 then
  1721. findnormalrandoms;
  1722. waithumanclick;
  1723. logout;
  1724. if (not (loggedin)) then
  1725. break;
  1726. until (not (loggedin));
  1727. if (not (loggedin)) then
  1728. begin
  1729. writeln('messed up logging out and in to fix, if you get this and your not in combat please check your gear and match it with the HP bar colors, if your gear has the Colors of the HP bar then change your outfit!');
  1730. writeln('logged out due to mess up');
  1731. inc(Messedup);
  1732. exit;
  1733. end;
  1734. end;
  1735. end;
  1736.  
  1737. procedure fixposition;
  1738. var
  1739. t: integer;
  1740. begin
  1741. marktime(t);
  1742. repeat
  1743. wait(400);
  1744. if ColorLocate('SkillScreen') then
  1745. exit;
  1746. if ColorLocate('RangeScreen') then
  1747. exit;
  1748. if (findbanksymbol) then
  1749. exit;
  1750. if (not (loggedin)) then
  1751. exit;
  1752. makecompass(randomrange(130, 160));
  1753. setangle(1);
  1754. if ColorLocate('meleer') then
  1755. exit;
  1756. if (not (loggedin)) then
  1757. exit;
  1758. if (findbanksymbol) then
  1759. exit;
  1760. wait(400);
  1761. if ColorLocate('SkillScreen') then
  1762. exit;
  1763. if ColorLocate('RangeScreen') then
  1764. exit;
  1765. if (outofrunes) then
  1766. exit;
  1767. if (gethpbarabove) then
  1768. exit;
  1769. makecompass(randomrange(40, 60));
  1770. until (TimeFromMark(t) > MaxNpcTime);
  1771. if (timefromMark(t) >= MaxNpcTime) then
  1772. begin
  1773. if ColorLocate('SkillScreen') then
  1774. exit;
  1775. if ColorLocate('RangeScreen') then
  1776. exit;
  1777. if not ColorLocate('meleer') and Loggedin then
  1778. begin
  1779. writeln('failed to find melee, going to log out and log in');
  1780. repeat
  1781. if (not (loggedin)) then
  1782. exit;
  1783. wait(400);
  1784. logout;
  1785. if (not (loggedin)) then
  1786. exit;
  1787. if (not (loggedin)) then
  1788. exit;
  1789. until (not (loggedin));
  1790. end;
  1791. end;
  1792. end;
  1793.  
  1794. procedure CurseLoop;
  1795. begin
  1796. if (not (loggedin)) then
  1797. exit;
  1798. wait(randomrange(WaitMemory1, WaitMemory2));
  1799. if (not (loggedin)) then
  1800. exit;
  1801. repeat
  1802. wait(randomrange(WaitMemory1, WaitMemory2));
  1803. if (findbanksymbol) then
  1804. exit;
  1805. if (not (loggedin)) then
  1806. exit;
  1807. if (AttempSolvingRandoms = true) and findtalk2 then
  1808. findnormalrandoms;
  1809. waitmore;
  1810. if (Breakhandler = true) then
  1811. takebreaks;
  1812. waitmore;
  1813. LocateMonster;
  1814. if (ColorLocate('AtSafeSpot') and (not (getHpBarAbove)) and (not (ColorLocate('meleer')))) and Loggedin then
  1815. FixPosition;
  1816. if GetHpBarAbove then
  1817. begin
  1818. if (ColorLocate('AtSafeSpot')) and (GetHpBarAbove) and (Loggedin) then
  1819. FixMessup;
  1820. end;
  1821. waitmore;
  1822. if ColorLocate('RangeScreen') then
  1823. closerangescreen;
  1824. waitmore;
  1825. if (CheckChatTabAll = true) and (ColorLocate('NotChatTabAll')) then
  1826. MakeMyChatTabAll;
  1827. waitmore;
  1828. if AlreadyWeakend then
  1829. NPCisWeakend;
  1830. waitmore;
  1831. if OutofRunes then
  1832. Termination('We have run out of Runes, terminating!');
  1833. waitmore;
  1834. if ColorLocate('SkillSCreen') then
  1835. CloseSkillScreen;
  1836. waitmore;
  1837. until (Findbanksymbol) or (not (loggedin));
  1838. end;
  1839.  
  1840. procedure SetPlayerUploop;
  1841. begin
  1842. wait(400);
  1843. if (not (loggedin)) then
  1844. exit;
  1845. writeln('we are here x21');
  1846. if ColorLocate('Meleer') and (not (ColorLocate('AtSafeSpot'))) and Loggedin then
  1847. WalktoSafeSpot;
  1848. waitmore;
  1849. if ClickContinueEx(false, false) then
  1850. begin
  1851. wait(randomrange(11000, 15000));
  1852. if (UseReflection = true) then
  1853. MyPosition := R_GetTileGlobal;
  1854. clicktocontinue;
  1855. end;
  1856. waitmore;
  1857. if ColorLocate('RangeScreen') then
  1858. CloseSkillScreen;
  1859. if Onlobbyscreen then
  1860. clicktoenterlobby;
  1861. waitmore;
  1862. end;
  1863.  
  1864. procedure InCaveloop;
  1865. begin
  1866. repeat
  1867. wait(randomrange(Waitmemory1, Waitmemory2));
  1868. if (not (loggedin)) then
  1869. exit;
  1870. writeln('we are here');
  1871. if ColorLocate('atsafespot') and Loggedin then
  1872. CurseLoop;
  1873. wait(randomrange(Waitmemory1, Waitmemory2));
  1874. if (not (ColorLocate('AtSafeSpot'))) and Loggedin then
  1875. SetPlayerUploop;
  1876. until (not (loggedin)) or (FindBanksymbol);
  1877. end;
  1878.  
  1879. procedure OutsideCaveloop;
  1880. begin
  1881. if (not (FindBanksymbol)) then
  1882. exit;
  1883. waitmore;
  1884. if (not (loggedin)) then
  1885. exit;
  1886. if (FindBanksymbol) then
  1887. EnterCaveLoop;
  1888. waitmore;
  1889. if ColorLocate('SkillSCreen') then
  1890. CloseSkillScreen;
  1891. waitmore;
  1892. if (AttempSolvingRandoms = true) then
  1893. findnormalrandoms;
  1894. waitmore;
  1895. if (not (GetHpbarabove)) then
  1896. Entercaveloop;
  1897. waitmore;
  1898. if (GetHpBarAbove) and (OutFailSafe = true) then
  1899. CheckifInDanger;
  1900. waitmore;
  1901. if CavesTime then
  1902. HandleCaveTime;
  1903. end;
  1904.  
  1905. procedure PlayerLoop;
  1906. begin
  1907. if (not (loggedin)) then
  1908. exit;
  1909. repeat
  1910. if (not (loggedin)) then
  1911. exit;
  1912. while (FindBanksymbol) and Loggedin do
  1913. OutsideCaveloop;
  1914. if (not (loggedin)) then
  1915. exit;
  1916. while (not (FindBanksymboL)) and Loggedin do
  1917. InCaveloop;
  1918. until (not (loggedin));
  1919. end;
  1920.  
  1921. {just checks settings...}
  1922. procedure CheckplayerSetup;
  1923. begin
  1924. if (EntranceMode > 3) or (EntranceMode < 1) then
  1925. begin
  1926. writeln('you have chosen a wrong entrance mode, please, choose one between 1,2 or 3');
  1927. terminatescript;
  1928. end;
  1929. if (AutoBankMM = true) and (ManualBankMM = true) then
  1930. begin
  1931. writeln('you have enabled both Manual and Automatic BankMM (Minimap) Color detection, please only choose one');
  1932. terminatescript;
  1933. end;
  1934. if (AutoBankMM = false) and (Autobankmm2 = false) then
  1935. begin
  1936. writeln('you have ENABLED both AUTOMATIC and automatic bankmm22 (Minimap) Color detection, please enable one (script cant run with both of them');
  1937. terminatescript;
  1938. end;
  1939. if (AutoBankMM = true) and (Autobankmm2 = true) then
  1940. begin
  1941. writeln('you have ENABLED both AUTOMATIC and automatic bankmm22 (Minimap) Color detection, please enable one (script cant run with both of them');
  1942. terminatescript;
  1943. end;
  1944. end;
  1945.  
  1946. procedure startitup;
  1947. begin
  1948. Playersetup;
  1949. SetupSRL;
  1950. if (UseReflection = true) then
  1951. SetupReflection;
  1952. ActivateClient;
  1953. SRL_CombatRandoms := False;
  1954. CheckplayerSetup;
  1955. StartTime;
  1956. end;
  1957.  
  1958. procedure loginloop;
  1959. begin
  1960. wait(400);
  1961. loginplayer;
  1962. if Onlobbyscreen then
  1963. clicktoenterlobby;
  1964. MakeCompass('n');
  1965. setangle(1);
  1966. end;
  1967.  
  1968. begin
  1969. startitup;
  1970. repeat
  1971. wait(400);
  1972. if (loggedin) then
  1973. begin
  1974. PlayerLoop;
  1975. end
  1976. else
  1977. begin
  1978. if (not (loggedin)) then
  1979. StartTime;
  1980. loginloop;
  1981. end;
  1982. until (false);
  1983. end.
Advertisement
Add Comment
Please, Sign In to add comment