Advertisement
Guest User

Untitled

a guest
Jul 19th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 8.00 KB | None | 0 0
  1. program Alch;
  2. {$DEFINE SMART}
  3. {$i SRL\SRL.scar}
  4. {$i Reflection\Reflection.Simba}
  5. {$i SRL\SRL\Misc\Stats.simba}
  6.  
  7.  
  8. const
  9.   S_Mems = True;    //Members?
  10.   S_World = 38;     //Smart world
  11.   S_Signed = True;  //Signed client?
  12.   LogOnMod = False; //Log out upon seeing a mod? True = DO, False = DO NOT
  13.   Stats_User = '';  //SRL Stats username
  14.   Stats_Pass = '';  //SRL Stats password
  15.  
  16.  
  17. procedure DeclarePlayers;
  18. begin
  19.   HowManyPlayers := 1;
  20.   NumberOfPlayers(HowManyPlayers);
  21.   CurrentPlayer := 0;
  22.  
  23.   with Players[0] do
  24.   begin
  25.     Name := '';  //RS Name
  26.     Pass := '';  //RS Pass
  27.     Integers[10] := 0; //Minutes to run, leave 0 to run forever
  28.     Integers[11] := 2200; //Alchs to do, leave 0 to run forever
  29.     Member := True; //Is the player a member?
  30.     BoxRewards := ['XP', 'oins'] //Rewards box rewards
  31.     Strings[0] := 'summoning'; //Lamp skill
  32.     Arrays[0] := [17]; //Inv slots to alch (e.g. [5, 6, 17])
  33.     Active := True; //Use?
  34.   end;
  35. end;
  36.  
  37.  
  38. var
  39.   StatsTimer, StartMark: Integer;
  40.  
  41.  
  42. const
  43.   Alchs = 0;
  44.   Levels = 1;
  45.   LmpSkill = 0;
  46.  
  47.  
  48. procedure MouseOffScreen(MinimumWait, RandomWait: Integer);
  49. var
  50.   Pt: TPoint;
  51.   w, h: Integer;
  52. begin
  53.   GetClientDimensions(w, h);
  54.   Pt := Point(RandomRange(-w, 2 * w), RandomRange(-h, 2 * h));
  55.   if ((Pt.x <= w) and (Pt.x >= 0)) and not((Pt.y <= 0) or (Pt.y >= 0)) then
  56.     IncEx(Pt.x, w);
  57.   MMouse(Pt.x, Pt.y, 0, 0);
  58.   Wait(MinimumWait + Random(RandomWait));
  59. end;
  60.  
  61.  
  62. procedure AntiBan; //call after ~click item~
  63. begin
  64.   case Random(99) of
  65.     1..5: MakeCompass(rs_GetCompassAngleDegrees - 4 + Random(8));
  66.     6: MouseOffScreen(10000, 15000);
  67.     11: HoverSkill(SKILL_MAGIC, False);
  68.   end;
  69.   GameTab(tab_Magic);
  70. end;
  71.  
  72.  
  73. function WaitTab(Tab, MaxTime: Integer): Boolean;
  74. var
  75.   T: Integer;
  76. begin
  77.   if not(LoggedIn) then
  78.     Exit;
  79.   T := GetSystemTime + MaxTime;
  80.   while (GetCurrentTab <> Tab) and (GetSystemTime <= T) do
  81.     WaitNone;
  82.   Result := (GetCurrentTab = Tab);
  83. end;
  84.  
  85.  
  86. function FixSpellBook: Boolean;
  87. var
  88.   i: Integer;
  89. begin
  90.   if not(LoggedIn) then
  91.     Exit;
  92.   GameTab(tab_Magic);
  93.   for i := 0 to 3 do
  94.     if (GetColor(584 + (i * 21), 442) <> 16711422) then
  95.     begin
  96.       Mouse(584 + (i * 21), 442, 15, 15, True);
  97.       Wait(600 + Random(400));
  98.     end;
  99.   if (GetColor(675, 442) <> 16711422) then
  100.   begin
  101.     Mouse(675, 442, 15, 15, True);
  102.     Wait(600 + Random(400));
  103.   end;
  104.   if (GetColor(727, 223) <> 5729142) then
  105.   begin
  106.     DragMouse(722, 278, 9, 10, 721, 199, 9, 10);
  107.     Wait(600 + Random(400));
  108.   end;
  109.   for i := 0 to 5 do
  110.   begin
  111.     if (i < 4) then
  112.       if (GetColor(584 + (i * 21), 442) <> 16711422) then
  113.         Exit;
  114.     if (i = 4) then
  115.       if (GetColor(675, 442) <> 16711422) then
  116.         Writeln('bleh');
  117.     if (i = 5) then
  118.       if (GetColor(727, 223) = 5729142) then
  119.         Result := True;
  120.   end;
  121. end;
  122.  
  123.  
  124. function Alch: Boolean;
  125. var
  126.   x, y: Integer;
  127.   AlchPoint: TPoint;
  128.   AlchBox: TBox;
  129. begin
  130.   if not(LoggedIn) or (GetCurrentTab <> tab_Magic) then
  131.     Exit;
  132.   case Players[CurrentPlayer].Member of
  133.     True:
  134.     begin
  135.       AlchPoint := Point(584, 374);
  136.       AlchBox := IntToBox(564, 362, 585, 382);
  137.     end;
  138.     False:
  139.     begin
  140.       AlchPoint := Point(704, 350);
  141.       AlchBox := IntToBox(683, 341, 707, 358);
  142.     end;
  143.   end;
  144.   if (GetColor(AlchPoint.x, AlchPoint.y) <> 2082667) then
  145.     if not(FixSpellBook) then
  146.       Exit;
  147.   GetMousePos(x, y);
  148.   if PointInBox(Point(x, y), AlchBox) then
  149.   begin
  150.     Writeln('Mouse was in alch box, not moving');
  151.     if (Random(99) <= 3) then //4% chance to move mouse in any direction
  152.       MMouse(x - 1, y - 1, 2, 2);
  153.     ClickMouse2(True);
  154.   end else
  155.     MouseBox(AlchBox.X1, AlchBox.Y1, AlchBox.X2, AlchBox.Y2, 1);
  156.   Result := WaitTab(tab_Inv, 2000);
  157. end;
  158.  
  159.  
  160. function ClickItem: Boolean;
  161. var
  162.   i, x, y: Integer;
  163.   Box: TBox;
  164. begin
  165.   if not(LoggedIn) then
  166.     Exit;
  167.   for i := 0 to High(Players[CurrentPlayer].Arrays[0]) do
  168.   begin
  169.     if not(ExistsItem(Players[CurrentPlayer].Arrays[0][i])) then
  170.       Continue;
  171.     Box := InvBox(Players[CurrentPlayer].Arrays[0][i]);
  172.     GetMousePos(x, y);
  173.     if (PointInBox(Point(x, y), Box)) then
  174.     begin
  175.       Writeln('mouse was already over item, not moving');
  176.       if (Random(99) = 0) then
  177.         MMouse(x - 1, y - 1, 2, 2);
  178.       ClickMouse2(True);
  179.     end else
  180.       MouseBox(Box.X1, Box.Y1, Box.X2, Box.Y2, 1);
  181.     Break;
  182.   end;
  183.   Result := WaitTab(tab_Magic, 2000);
  184. end;
  185.  
  186.  
  187. procedure SinglePlayerReport;
  188. begin
  189.   Writeln('<! >-------------------------------------------------< !>');
  190.   Writeln('<! > TomTuff''s Alcher                                < !>');
  191.   Writeln('<! >-------------------------------------------------< !>');
  192.   Writeln('<! > Time Running: ' + MsToTime(PlayerWorked(CurrentPlayer), Time_Abbrev));
  193.   Writeln('<! > Alchs: ' + IntToStr(Players[CurrentPlayer].Integers[Alchs]));
  194.   Writeln('<! > Exp: ' + IntToStr(Players[CurrentPlayer].Integers[Alchs] * 65));
  195.   if (Players[CurrentPlayer].Integers[Levels] > 0) then
  196.     Writeln('<! > Levels: ' + IntToStr(Players[CurrentPlayer].Integers[Levels]));
  197.   Writeln('<! >-------------------------------------------------< !>');
  198. end;
  199.  
  200.  
  201. procedure MultiPlayerReport;
  202. var
  203.   i: Integer;
  204. begin
  205.   Writeln('<! >-------------------------------------------------< !>');
  206.   Writeln('<! > TomTuff''s Alcher                                < !>');
  207.   Writeln('<! >-------------------------------------------------< !>');
  208.   for i := 0 to High(Players) do
  209.   begin
  210.     Writeln('<! > Player ' + IntToStr(i));
  211.     Writeln('<! > Time: ' + MsToTime(PlayerWorked(i), Time_Abbrev));
  212.     Writeln('<! > Alchs: ' + IntToStr(Players[i].Integers[Alchs]));
  213.     Writeln('<! > Exp: ' + IntToStr(Players[i].Integers[Alchs] * 65));
  214.     if (Players[i].Integers[Levels] > 0) then
  215.       Writeln('<! > Levels: ' + IntToStr(Players[CurrentPlayer].Integers[Levels]));
  216.     Writeln('<! >-------------------------------------------------< !>');
  217.   end;
  218. end;
  219.  
  220.  
  221. procedure Report;
  222. begin
  223.   if (Length(Players) = 1) then
  224.     SinglePlayerReport;
  225.   if (Length(Players) > 1) then
  226.     MultiplayerReport;
  227. end;
  228.  
  229.  
  230. procedure Commit;
  231. begin
  232.   if (TimeFromMark(StatsTimer) < 300000) then
  233.     Exit;
  234.   stats_Commit;
  235.   MarkTime(StatsTimer);
  236. end;
  237.  
  238.  
  239. function CheckSum: Boolean;
  240. begin
  241.   if (Players[CurrentPlayer].Integers[10] > 0) then
  242.     if (PlayerWorked(CurrentPlayer) > Players[CurrentPlayer].Integers[10]) then
  243.     begin
  244.       Result := True;
  245.       Exit;
  246.     end;
  247.   if (Players[CurrentPlayer].Integers[11] > 0) then
  248.     if (Players[CurrentPlayer].Integers[Alchs] > Players[CurrentPlayer].Integers[11]) then
  249.     begin
  250.       Result := True;
  251.       Exit;
  252.     end;
  253. end;
  254.  
  255.  
  256. procedure MainLoop;
  257. var
  258.   Attempts: Integer;
  259. begin
  260.   Smart_Members := S_Mems;
  261.   Smart_Server := S_World;
  262.   Smart_Signed := S_Signed;
  263.   Smart_SuperDetail := False;
  264.   SetupSRL;
  265.   SetupSRLStats(37, Stats_User, Stats_Pass);
  266.   DeclarePlayers;
  267.   if LogOnMod = True then
  268.     LogoutOnMod := False;
  269.   MarkTime(StatsTimer);
  270.   while not(LoggedIn) do
  271.     LogInPlayer;
  272.   MarkTime(StartMark);
  273.   repeat
  274.     GameTab(tab_Magic);
  275.     SetAngle(True);
  276.     LampSkill := Players[CurrentPlayer].Strings[LmpSkill];
  277.     repeat
  278.       if Alch then
  279.       begin
  280.         Wait(800 + Random(200));
  281.         //GameTab(tab_Inv);
  282.         if ClickItem then
  283.         begin
  284.           stats_IncVariable('High Level Alchs', 1);
  285.           stats_IncVariable('Total EXP Gained', 65);
  286.           Inc(Players[CurrentPlayer].Integers[Alchs]);
  287.           Wait(800 + Random(200));
  288.           if LevelUp then
  289.           begin
  290.             stats_IncVariable('Total Levels Gained', 1);
  291.             Inc(Players[CurrentPlayer].Integers[Levels]);
  292.           end;
  293.           AntiBan;
  294.           R_FindRandoms;
  295.           Attempts := 0;
  296.         end else Inc(Attempts);
  297.       end else Inc(Attempts);
  298.       Report;
  299.       Commit;
  300.       //if (Attempts > 50) then
  301.         //Logout;
  302.     until(CheckSum or not(LoggedIn));
  303.     Report;
  304.     Commit;
  305.     NextPlayer(False);
  306.   until(AllPlayersInactive);
  307.   Report;
  308. end;
  309.  
  310.  
  311. begin
  312.   MainLoop;
  313. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement